dynamic-import-iife
"Dynamic import"/lazyload IIFE bundles in the browser
Last updated 3 years ago by tehshrike .
WTFPL · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dynamic-import-iife 
SYNC missed versions from official npm registry.

Dynamically import IIFE (and JSON) files in the browser.

For when you want to lazy-load some files, or do some really basic code splitting.

const load = require('dynamic-import-iife')

load('/some-iife.js').then(usefulFunctionExportedByModule => {
	usefulFunctionExportedByModule() // cool!
})

promise = load(url, [options])

  • url: string
  • options: object
    • type: string. Either 'iife' or 'json'

The promise will reject if there is an error fetching or evaluating the file.

If the file is successfully evaluated, the result will be cached for future requests.

License

WTFPL

Current Tags

  • 1.0.3                                ...           latest (3 years ago)

4 Versions

  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (13)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |