Skip to content

Instantly share code, notes, and snippets.

@chrisparnin
Created February 19, 2020 14:48
Show Gist options
  • Save chrisparnin/4103a5fae7ad3cd611e7833cfed6f5d6 to your computer and use it in GitHub Desktop.
Save chrisparnin/4103a5fae7ad3cd611e7833cfed6f5d6 to your computer and use it in GitHub Desktop.
Trace stack traces when a promise resolves.
class StackPromise extends Promise {
constructor(args) {
super((myresolve, myreject) =>
{
let fn = function(result) {
console.log(new Error("Promise resolved").stack);
myresolve(result);
}
args.call(null, fn, myreject );
});
}
}
global.Promise = StackPromise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment