jrburke / module Goto Github PK
View Code? Open in Web Editor NEWA modern JavaScript module system
A modern JavaScript module system
The main weakness in using return
at the bottom of a definition to declare the exports is that this is synchronous. If your module needs to do asynchronous work in order to initialise itself, you inevitably end up having to expose that asynchronous nature to other modules that depend on it (by exporting callbacks or promises).
I think return
is still great syntax for wholly-synchronous modules.
One example of an asynchronous module is a module that always needs to perform an XMLHttpRequest
during its initialisation, where it is highly convenient for all other client modules to be wholly-synchronous (no desire for asynchronous-ness to spread like a virus through the rest of the modules).
Should we consider these out of scope for the module system? If there are, indeed, within the scope, how do we asynchronously declare the exports of a module at a later time?
As Promise
is now part of ES6, could we just return the Promise and have the module system automatically wait for its resolution prior to sharing the exports with other modules?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.