tr1ckydev / webview-bun

Bun bindings for webview, a tiny library for creating web-based desktop GUIs.

Home Page:https://www.npmjs.com/package/webview-bun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webview-bun

bun bindings for webview

Webview is a tiny cross-platform library to make web-based GUIs for desktop applications.

Installation

Platforms supported: linux, macos-x64, macos-arm64

  • Install webkit2gtk dependency for linux.

    Ubuntu: sudo apt-get install libwebkit2gtk-4.0-dev

    Arch Linux: yay -S webkit2gtk

  • Install webview-bun and the latest compiled webview library from the releases of this repository.

    bun i webview-bun && bun node_modules/webview-bun/fetchLib.ts

Example

import { Webview } from "webview-bun";

const html = `
<html>
    <body>
        <h1>Hello from bun v${Bun.version} !</h1>
    </body>
</html>
`;

const webview = new Webview();

webview.setHTML(html);
webview.run();

For more examples, browse the examples folder of this repository.

Documentation

Refer to the comments in the source code for full documentation.

Development

Building

  • Clone the repository along with the webview submodule.

    git clone --recurse-submodules --remote-submodules https://github.com/tr1ckydev/webview-bun.git
  • Install bun-types and build the library for your platform

    bun i && bun run build

    or, fetch the latest compiled library from the releases of this repository.

    bun i && bun run postinstall

Running

To use your own built webview library, set the WEBVIEW_PATH environment variable with the path to your webview shared library file.

Run the following example to see it in action.

bun run examples/basic.ts

Credits

This repository is a direct port of webview_deno by @eliassjogreen with various changes to work with the bun runtime.

License

This repository uses MIT license. See LICENSE for full license text.

About

Bun bindings for webview, a tiny library for creating web-based desktop GUIs.

https://www.npmjs.com/package/webview-bun

License:MIT License


Languages

Language:TypeScript 92.5%Language:Batchfile 7.5%