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
such as this
test("aa", async () => { function* yieldButNotAsync() { yield 1; yield 2; console.log(`end`); } async function asyncGenFunc() { // do something async console.log(`start`); const timeout = 2000; await new Promise((resolve) => setTimeout(resolve, timeout)); return yieldButNotAsync.apply(this, arguments); } // 让他同步 function synGenFunc() { let isDone = false; let result; asyncGenFunc.apply(this, arguments).then((iter) => { isDone = true; result = iter; }); // 用 deasync 等待让他同步化 require("deasync").loopWhile(function () { return !isDone; }); return result; } (function () { const iter = synGenFunc(); const value = iter.next(); console.log(`value`, value); const value2 = iter.next(); console.log(`value2`, value2); })(); });
The text was updated successfully, but these errors were encountered:
#156 #156
Sorry, something went wrong.
No branches or pull requests
such as this
The text was updated successfully, but these errors were encountered: