Created
June 1, 2022 15:34
-
-
Save GitaiQAQ/7399706c2e096835c18b79e7dc6000b2 to your computer and use it in GitHub Desktop.
InvertedPromise.js
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
function InvertedPromise() { | |
let _ = undefined; | |
return Object.assign(new Promise((resolve, reject) => { _ = { 0: resolve, 1: reject, resolve, reject } }), _); | |
} | |
function InvertedPromise() { | |
let _ = undefined; | |
return _ = new Promise((resolve, reject) => | |
Promise.resolve() | |
.then(() => Object.assign(_, { resolve, reject }))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment