Module import/export bindings

caridy caridy at gmail.com
Mon Mar 16 03:11:56 UTC 2015


correct, it is about evaluation.

yes, modules will have access to window, and any other runtime feature.

no, I don't recommend using modules to patch the runtime, features should probably be patched before attempting to load any module (maybe using FT polyfill service).

/caridy

> On Mar 15, 2015, at 10:57 PM, Glen Huang <curvedmark at gmail.com> wrote:
> 
> My guess is that it’s for importing modules that expose objects via the global object (e.g., window).
> 
> However I do have a question: is it possible for a module to access the global object without relying on the host environment?
> 
> One use case is to polyfill the language's standard library. es6-shim uses a pretty ugly hack (https://github.com/paulmillr/es6-shim/blob/e17ca7ad73528261a3fc4af2ad71ebc3c8f84c0e/es6-shim.js#L76 <https://github.com/paulmillr/es6-shim/blob/e17ca7ad73528261a3fc4af2ad71ebc3c8f84c0e/es6-shim.js#L76>).
> 
> I wonder what’s the most elegant way to do that?
> 
>> On Mar 16, 2015, at 3:59 AM, Kyle Simpson <getify at gmail.com <mailto:getify at gmail.com>> wrote:
>> 
>> Thanks, all answers super helpful!
>> 
>> One last clarification:
>> 
>> ```js
>> import "foo";
>> ```
>> 
>> This doesn't do any binding does it? AFAICT, it just downloads and runs the module (if it hasn't already)?
>> 
>> If that's true, what's the use-case here besides "preloading" a module performance wise?
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150315/996d6f5f/attachment.html>


More information about the es-discuss mailing list