jorendorff / js-loaders

Pseudoimplementation of the proposed ES6 module loaders.
54 stars 7 forks source link

Dynamic load script #92

Open johnjbarton opened 10 years ago

johnjbarton commented 10 years ago

The current API is curiously missing a function to dynamically load source but evaluate it as Script.

Loader.import(name): fetch name, parse as module, Loader.define(name, source): parse 'source' as module, Loader.missingFeature(name): fetch name, parse as script, Loader.eval(source): parse 'source' as script.

IMO Loader.eval() ought to be removed, it duplicates the built-in eval() function. On the other hand, an officially blessed and cross-browser solution for loading scripts would be awesome.