Actively thinking about "live bindings" may honestly confuse the way you
think about imports. When you do

    export var foo = "value";

then

    import {foo} from "./foo";
    console.log(foo);

Every time you access `foo` in the second module, you are literally
reaching into the first module to grab the current value of `foo`. You can
think of it like this, in CommonJS terms:

    var foo = "value";

    Object.defineProperty(exports, 'foo', { get(){ return foo; } }

and

    var fooMod = require('./foo');
    console.log(fooMod.foo);

so accessing the 'foo' export calls a getter method to access the current
value of `foo`, so any change to the value inside the first module will
immediately change the next time you trigger the getter.

On Thu, Aug 11, 2016 at 5:35 PM, /#!/JoePea <[email protected]> wrote:

> Are bindings live across all modules at the same time, as if the
> identifier were defined in an outer scope common to all the modules that
> import it?
>
> */#!/*JoePea
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to