@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
15 lines • 668 B
JavaScript
import { isMainThread } from "node:worker_threads";
function isNativeWebViewClass(value) {
return typeof value === "function" && typeof Reflect.get(value, "closeAll") === "function";
}
/** `Bun.WebView` when this thread may construct Chrome-backed views: Bun runtime, process main thread. */
export function mainThreadWebViewClass() {
if (!isMainThread)
return undefined;
const bun = Reflect.get(globalThis, "Bun");
if (typeof bun !== "object" || bun === null)
return undefined;
const webView = Reflect.get(bun, "WebView");
return isNativeWebViewClass(webView) ? webView : undefined;
}
//# sourceMappingURL=native-webview.js.map