Browser backend. Defaults to "webkit" on macOS, throws on other platforms unless "chrome" is specified.
interface
WebView.ConstructorOptions
interface ConstructorOptions
- dataStore?: 'ephemeral' | { directory: string }
Storage backing for cookies, localStorage, IndexedDB, etc.
"ephemeral"(default): in-memory only, nothing written to disk.{ directory }: persistent storage rooted at the given path. Multiple views with the same directory share state.
Chrome backend:
directoryis per-Chrome-process (--user-data-dir), not per-view. The first view's directory applies to all views spawned in the same Bun process. - url?: string
Initial URL to navigate to. The navigation starts before the constructor returns;
await view.navigate(otherUrl)or any other operation will wait for it to complete first.Equivalent to calling
view.navigate(url)immediately after construction.