simpler, sweeter syntax for modules

Kevin Smith khs4473 at gmail.com
Thu Mar 22 06:43:24 PDT 2012


Correct me if I have any of this wrong, but modules don't need to be
callable for the jQuery use case:

    // jquery.js
    export function $(...) { ... }

    // program.js
    import $ from "path/to/jquery.js";

    $("#elem").whatever

We don't need "node style" modules-as-classes either:

    // MyClass.js
    export function MyClass() { ... }

    // program.js
    import MyClass from "MyClass.js";
    new MyClass;

or more succinctly:

    // program.js
    import * from "MyClass.js";
    new MyClass;

kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120322/b336cc6d/attachment.html>


More information about the es-discuss mailing list