Repository navigation
Is it possible to embed deno_core with a self-managed event loop?
#25799
|
And the 2nd question is: does the API Because after reading some tutorials and source code of For example, if we have below sample code: async function readFile(filename) {
// Read a file in async mode
}
async function sleepFor(seconds) {
// Sleep for seconds
}
const content = await readFile("README.md");
console.log(`We have read: ${content}`);
await sleepFor(10);
console.log(`We have sleep for 10s`);Once the Then we call the If it only runs for 1 tick, then I can embed it into my command line TUI application. Because the TUI application uses If it waits for all async tasks done, then it means it cannot work along with the tokio runtime managed by my TUI application. Because it can block the terminal.
|
Replies: 4 comments 3 replies
|
Oh, I found this: https://discord.com/channels/684898665143206084/1243892880188248084 Seems the |
No, it runs for as long as event loop finishes all work. If you want to run a single "tick" you should use |
|
@bartlomieju hi, maybe this pattern possible? https://www.electronjs.org/blog/electron-internals-node-integration |
|
this maybe help https://github.com/congzhangzh/asyncio-guest/tree/master |
No, it runs for as long as event loop finishes all work. If you want to run a single "tick" you should use
JsRuntime::poll_event_loop.