Skip to content

Instantly share code, notes, and snippets.

@digitalhitler
Created January 19, 2016 20:25
Show Gist options
  • Save digitalhitler/e01c4dfc3b1f4d33e05f to your computer and use it in GitHub Desktop.
Save digitalhitler/e01c4dfc3b1f4d33e05f to your computer and use it in GitHub Desktop.
Promise-way sandboxed context module preloading and then executing code.
// It is not yet another reinventing the well.
// Did you ever see what's happens with module that requires lots of times in
// a row for example in Express?
// Check it out and come back!
Promise.all(['module1', 'module2', 'module3']
.map(x => System.import(x)))
.then(([module1, module2, module3]) => {
// Do something in separate scope.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment