Skip to content

Commit

Permalink
import "WebviewTag" via namespace vs type (@electron v15+ support)
Browse files Browse the repository at this point in the history
* @electron stopped exporting "WebviewTag" interface/type since v15 but it's still available for referencing using the "Electron.WebviewTag" way.
  • Loading branch information
vladimiry committed Sep 2, 2021
1 parent a11c8d3 commit fb3a448
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/webview-api-service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Lib from "pubsub-to-rpc-api";
import UUID from "pure-uuid";
import {IpcMessageEvent, IpcRenderer, WebviewTag} from "electron";
import {IpcMessageEvent, IpcRenderer} from "electron";

import * as PM from "./private/model";
import {curryOwnFunctionMembers} from "./private/util";
Expand All @@ -12,7 +12,7 @@ type ACA2 = [IpcMessageEvent, ...PM.Any[]]; // used by "pubsub-to-rpc-api" like
type RegisterApiIpcRenderer = Pick<IpcRenderer, "on" | "removeListener" | "sendToHost">;

const ipcRendererEventEmittersCache = new WeakMap<RegisterApiIpcRenderer, Lib.Model.CombinedEventEmitter>();
const webViewTagEventEmittersCache = new WeakMap<WebviewTag, Lib.Model.CombinedEventEmitter>();
const webViewTagEventEmittersCache = new WeakMap<Electron.WebviewTag, Lib.Model.CombinedEventEmitter>();

const clientIpcMessageEventName = "ipc-message";
const clientIpcMessageListenerBundleProp = Symbol(`[${PM.MODULE_NAME}] clientIpcMessageListenerBundleProp symbol`);
Expand All @@ -25,7 +25,7 @@ export function createWebViewApiService<AD extends Lib.Model.ApiDefinition<AD>>(
options?: Lib.Model.CreateServiceRegisterOptions<AD, ACA2> & { ipcRenderer?: RegisterApiIpcRenderer; },
) => ReturnType<Lib.Model.CreateServiceReturn<AD, ACA2>["register"]>;
client: (
webView: WebviewTag,
webView: Electron.WebviewTag,
params?: { options?: Partial<Lib.Model.CallOptions<AD, ACA2>> },
) => ReturnType<Lib.Model.CreateServiceReturn<AD, ACA2>["caller"]>;
} {
Expand Down

0 comments on commit fb3a448

Please sign in to comment.