Skip to content

Instantly share code, notes, and snippets.

@ithinkihaveacat
Created May 3, 2017 12:35
Show Gist options
  • Save ithinkihaveacat/e1f1641a8d33f098b777b9aad155a4b5 to your computer and use it in GitHub Desktop.
Save ithinkihaveacat/e1f1641a8d33f098b777b9aad155a4b5 to your computer and use it in GitHub Desktop.
window.myLibrary = (() => { let a, p = new Promise((...args) => a = args); [p.resolve, p.reject] = a; return p; })();
window.myLibrary.resolve("jjj"); // when library ready
window.myLibrary.then(console.log); // outputs "jjj"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment