UNPKG

@sussudio/platform

Version:

Internal APIs for VS Code's service injection the base services.

23 lines (22 loc) 1.03 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Disposable } from '@sussudio/base/common/lifecycle.mjs'; import { Client as IPCElectronClient } from '@sussudio/base/parts/ipc/electron-sandbox/ipc.electron.mjs'; /** * An implementation of `IMainProcessService` that leverages Electron's IPC. */ export class ElectronIPCMainProcessService extends Disposable { mainProcessConnection; constructor(windowId) { super(); this.mainProcessConnection = this._register(new IPCElectronClient(`window:${windowId}`)); } getChannel(channelName) { return this.mainProcessConnection.getChannel(channelName); } registerChannel(channelName, channel) { this.mainProcessConnection.registerChannel(channelName, channel); } }