How to use the electron-rpc-api.createWebViewApiService function in electron-rpc-api

To help you get started, we’ve selected a few electron-rpc-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vladimiry / ElectronMail / src / shared / api / webview / protonmail.ts View on Github external
import {ZoneApiParameter} from "src/shared/api/common";
import {buildLoggerBundle} from "src/electron-preload/util";
import {buildWebViewApiDefinition, channel} from "./common";

export type ProtonmailApiScan = ScanService;

export type ProtonmailApi = ProtonmailApiScan["ApiClient"];

export type ProtonmailNotificationOutput = Partial & Partial<{ batchEntityUpdatesCounter: number }>;

export const PROTONMAIL_IPC_WEBVIEW_API_DEFINITION = {
    ...buildWebViewApiDefinition<"protonmail", ProtonmailNotificationOutput>(),
    unlock: ActionType.Promise(),
} as const;

export const PROTONMAIL_IPC_WEBVIEW_API = createWebViewApiService({
    channel,
    apiDefinition: PROTONMAIL_IPC_WEBVIEW_API_DEFINITION,
    logger: buildLoggerBundle("[IPC_WEBVIEW_API:protonmail]"),
});
github vladimiry / ElectronMail / src / shared / api / webview / tutanota.ts View on Github external
import {NotificationsTutanota} from "src/shared/model/account";
import {buildLoggerBundle} from "src/electron-preload/util";
import {buildWebViewApiDefinition, channel} from "./common";

export type TutanotaNotificationOutput = Partial & Partial<{ batchEntityUpdatesCounter: number }>;

export type TutanotaScanApi = ScanService;

export type TutanotaApi = TutanotaScanApi["ApiClient"];

export const TUTANOTA_IPC_WEBVIEW_API_DEFINITION = {
    ...buildWebViewApiDefinition<"tutanota", TutanotaNotificationOutput>(),
} as const;

export const TUTANOTA_IPC_WEBVIEW_API = createWebViewApiService({
    channel,
    apiDefinition: TUTANOTA_IPC_WEBVIEW_API_DEFINITION,
    logger: buildLoggerBundle("[IPC_WEBVIEW_API:tutanota]"),
});

electron-rpc-api

Wrapper around the Electron's IPC for building type-safe API based RPC-like and reactive interactions

MIT
Latest version published 11 months ago

Package Health Score

53 / 100
Full package analysis