Skip to content

Instantly share code, notes, and snippets.

@diorahman
Created October 16, 2016 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diorahman/789db19a53016e4bfcdb7580e6a9d877 to your computer and use it in GitHub Desktop.
Save diorahman/789db19a53016e4bfcdb7580e6a9d877 to your computer and use it in GitHub Desktop.
__async
function __async(g) {
return new Promise(function(s, j) {
function c(a, x) {
try {
var r = g[x ? "throw" : "next"](a)
} catch (e) {
j(e);
return
}
r.done ? s(r.value) : Promise.resolve(r.value).then(c, d)
}
function d(e) {
c(e, 1)
}
c()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment