webview bindings for bun runtime
bun add @evan/webview
import { Window } from '@evan/webview';
// window is bound to bun's lifetime
// window will not prevent bun from exiting
const window = new Window({
titlebar: true, // enable/disable titlebar (default: true) [macos-only]
resizable: true, // enable/disable resizing window (default: true)
maximized: false, // start window maximized (default: false)
fullscreen: false, // start window in fullscreen mode (default: false)
title: 'Hello World', // set window's title (default: none)
always_on_top: false, // keep window always on top (default: false)
user_agent: 'bun!!!!', // set user agent (default: webkit's user agent)
js: 'console.log(1)', // inject js code before loading url/html (default: none)
url: 'https://www.google.com', // start window with url (default: blank)
// or html: '<h1>Hello World</h1>', // start window with html (default: "")
size: {
width: 800, height: 600, // default window size
min: { width: 400, height: 300 }, // min window size
max: { width: 1024, height: 768 }, // max window size
},
});
window.kill(); // close webview window
window.wait(); // wait for window to close (blocks main thread)
Apache-2.0 © Evan