1.0.3 • Published 7 years ago

dynamic-import-iife v1.0.3

Weekly downloads
2
License
WTFPL
Repository
github
Last release
7 years ago

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