webview_deno
webview_deno copied to clipboard
How to run in background?
You want to run webiview without freezing the main script ? As I know, there is no simple way to run in background since webview handle the client event loop. You can run webview in a worker or a sub process and send data to client via websocket but you don't have direct access of the server part. I'm working on a pull request to solve that via an async api but this project seems to be slowing down.
If what you want is what JOTSR described, you can achieve this by doing an non-awaited asynchronous function as I did.
import {Webview, SizeHint} from "jsr:@webview/webview";
import {loadImage} from "https://deno.land/x/[email protected]/mod.ts";
(async () => {
const image = await loadImage("E:/AniWorld.png");
const webview = new Webview(false, {height: image.height(), width: image.width(), hint: SizeHint.FIXED});
// Load image file at "E:\AniWorld.png"
webview.navigate("E:/AniWorld.png");
webview.run();
})();
const urls = [
"https://aniworld.to/anime/stream/golden-time",
];
console.log(urls.join("\n"));
The main part is
(async () => { /* Code here */ })()