We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原文:https://juejin.cn/post/6844904148899463175
function wrap(p) { let obj = {}; let p1 = new Promise((resolve, reject) => { obj.resolve = resolve; obj.reject = reject; }); obj.promise = Promise.race([p1, p]); return obj; } let promise = new Promise((resolve, reject) => { setTimeout(() => { resolve(123); }, 1000); }); let obj = wrap(promise); obj.promise.then(res => { console.log(res); }); obj.resolve("请求被拦截了"); obj.reject("请求被拒绝了");
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: