2.0.0 • Published 1 month ago

webview-bun v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

webview-bun

bun bindings for webview

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

npm.io

Installation

Platforms supported: win64, 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 with trust flag to run postinstall to automatically fetch pre-built library from latest release.

    bun i --trust webview-bun

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
    cd webview-bun
    bun i
  • Build the library for your platform.

    !IMPORTANT
    If you are on Windows, you need to have c++ compiler in your PATH. If not already, follow the steps here to install.

    bun run build

Running

!TIP To use your own 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

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

Credits

This repository is a port of webview_deno with various changes to work with the bun runtime and new windows build script to compile the latest webview.

License

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

2.0.0

1 month ago

1.0.1

10 months ago

1.0.0

10 months ago