deno bindings for webview using the webview_rust. Webview is a tiny cross-platform library to render web-based GUIs for desktop applications.
⚠️ This project is still in an early stage of development. Expect breaking changes.
import { WebView } from "https://deno.land/x/webview/mod.ts";
const html = `
<html>
<body>
<h1>Hello from deno</h1>
</body>
</html>
`;
await new WebView({
title: "Local webview_deno example",
url: `data:text/html,${encodeURIComponent(html)}`,
height: 600,
resizable: true,
debug: true,
frameless: false,
}).run();
you can run this example directly from the web:
$ deno run -A -r --unstable https://deno.land/x/webview/examples/local.ts
or in your development environment:
$ deno run -A -r --unstable app.ts
you can find other examples in the [example/](https://github.com/webview/webview_deno/blob/master/examples)
directory.
You can find the official documentation here.
For building webview_deno the same prerequisites as for building deno is required.
sudo apt-get install libwebkit2gtk-4.0-dev
)Building webview_deno can take a nontrivial amount of time depending on your operating system. After the first build most files will be cached so building time will be reduced. Building on Windows requires admin privileges.
For a default build you can use the provided script:
deno run -A scripts/build.ts
which internally runs:
optionally you can use mshtml:
deno run -A scripts/build.ts mshtml
To run webview_deno without automatically downloading the binaries from releases you will need to use the environment variable WEBVIEW_DENO_PLUGIN
and set it to the path where the built binaries are located. This is usually file://./target/release
. The process of running and using local binaries can be easier to using the dev script:
deno -A scripts/dev.ts [example.ts]
WEBVIEW_DENO_PLUGIN
- The URL of the pluginWEBVIEW_DENO_PLUGIN
variable to the path of a binary build built with the --no-default-features
flag or using deno -A scripts/build.ts mshtml
WEBVIEW_DENO_PLUGIN_BASE
- The URL of the plugin except the last part. Ignored if WEBVIEW_DENO_PLUGIN
is set.WEBVIEW_DENO_PLUGIN_BASE
should be set to the directory containing the plugin binary, usually file://./target/release
. Otherwise, don’t set this.WEBVIEW_DENO_DEBUG
- Disable cache and enable logs for plug
. Used for debugging.Pull request, issues and feedback are very welcome. Code style is formatted with denon fmt
(which internally runs deno fmt
and cargo fmt
) and commit messages are done following Conventional Commits spec.
Author: webview
Live Demo: https://deno.land/x/webview
GitHub: https://github.com/webview/webview_deno
#deno #javascript #nodejs #node-js