Created
February 19, 2020 14:48
-
-
Save chrisparnin/4103a5fae7ad3cd611e7833cfed6f5d6 to your computer and use it in GitHub Desktop.
Trace stack traces when a promise resolves.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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