Last active
December 5, 2019 04:05
-
-
Save kumavis/0e0893459c690edd09a3221ace0af5d0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
_then = Promise.prototype.then | |
// [Function: then] | |
Promise.prototype.then = function(){ console.log('then!'); return _then.apply(this, arguments); } | |
// [Function (anonymous)] | |
p = new Promise(resolve => resolve()) | |
// Promise { undefined } | |
p.then() | |
// then! | |
// Promise { <pending> } | |
(async function () { await Promise.resolve(1) })() | |
// Promise { <pending> } | |
(async function () { await new Promise(resolve => resolve()) })() | |
// Promise { <pending> } |
This file contains hidden or 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
x = { then: (fn) => { console.log('thennable!'); fn() } } | |
// { then: [Function: then] } | |
(async function () { await x })() | |
// Promise { <pending> } | |
// thennable! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
node v13.3.0