From eaf919e04161cb5b0f9b2df17d1afd55640d03bd Mon Sep 17 00:00:00 2001 From: "Visal .In" Date: Wed, 13 Nov 2024 21:03:47 +0700 Subject: [PATCH] add communicate with electron via IPC --- src/drivers/iframe-driver.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/drivers/iframe-driver.ts b/src/drivers/iframe-driver.ts index 7add23a..fc8ffb5 100644 --- a/src/drivers/iframe-driver.ts +++ b/src/drivers/iframe-driver.ts @@ -1,3 +1,4 @@ +"use client"; import { DatabaseResultSet } from "./base-driver"; import MySQLLikeDriver from "./mysql/mysql-driver"; import { SqliteLikeBaseDriver } from "./sqlite-base-driver"; @@ -117,9 +118,10 @@ export class IframeSQLiteDriver extends SqliteLikeBaseDriver { } export class IframeMySQLDriver extends MySQLLikeDriver { - protected conn = window.outerbaseIpc - ? new ElectronConnection() - : new IframeConnection(); + protected conn = + typeof window !== "undefined" && window?.outerbaseIpc + ? new ElectronConnection() + : new IframeConnection(); listen() { this.conn.listen();