Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
/ webview Public
forked from just-be-dev/webview

A light, cross-platform library for building web-based desktop apps with Deno or Python.

License

Notifications You must be signed in to change notification settings

daxcee/webview

Open more actions menu
 
 

Repository files navigation

@justbe/webview

A light, cross-platform library for building web-based desktop apps. The project consists of a Rust backend that provides the core webview functionality, with multiple client libraries available for different languages and runtimes.

Available Clients

Architecture

This project is structured into two main components:

  1. A Rust backend that provides the core webview functionality, compiled into a native binary for each platform
  2. Client libraries that interface with the binary, available for multiple languages

Each client library handles binary management, communication with the webview process over stdio (standard input/output), and provides a idiomatic API for its respective language/runtime.

Binary Management

When using any of the clients, they will check for the required binary for interfacing with the OS's webview. If it doesn't exist, it downloads it to a cache directory and executes it. The specific behavior and permissions required may vary by client - please see the respective client's documentation for details.

Using a Custom Binary

All clients support using a custom binary via the WEBVIEW_BIN environment variable. If present and allowed, this will override the default binary resolution process in favor of the path specified.

Examples

Deno Example
import { createWebView } from "jsr:@justbe/webview";

using webview = await createWebView({
  title: "Example",
  html: "<h1>Hello, World!</h1>",
  devtools: true
});

webview.on("started", async () => {
  await webview.openDevTools();
  await webview.eval("console.log('This is printed from eval!')");
});

await webview.waitUntilClosed();
Python Example
import asyncio
from justbe_webview import WebView, WebViewOptions, WebViewContentHtml, WebViewNotification

async def main():
    config = WebViewOptions(
        title="Example",
        load=WebViewContentHtml(html="<h1>Hello, World!</h1>"),
        devtools=True
    )

    async with WebView(config) as webview:
        async def handle_start(event: WebViewNotification):
            await webview.open_devtools()
            await webview.eval("console.log('This is printed from eval!')")

        webview.on("started", handle_start)

if __name__ == "__main__":
    asyncio.run(main())

Contributing

This project uses mise to manage runtimes (like deno, python, rust) and run scripts. If you'd like to contribute, you'll need to install it.

Use the mise tasks command to see what you can do.

About

A light, cross-platform library for building web-based desktop apps with Deno or Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 54.8%
  • Rust 25.6%
  • Python 19.6%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.