Created
October 20, 2018 23:49
-
-
Save JiaLiPassion/e895833cd150854ffa56c88fdaacb1eb to your computer and use it in GitHub Desktop.
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
async function detect() { } | |
const r = detect(); | |
const nativeThen = r.__proto__.then; | |
r.__proto__.then = function () { | |
console.log('promise.then'); | |
return nativeThen.apply(this, arguments); | |
} | |
async function test1() { | |
console.log('before await'); | |
const r = await test(); | |
console.log('after await'); | |
} | |
test1(); | |
console.log('end'); | |
// the output will be | |
// before await | |
// end | |
// promise.then, question is why promise.then is after end? | |
// after await |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment