Path: blob/main/src/vs/workbench/api/browser/mainThreadDataChannels.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Disposable } from '../../../base/common/lifecycle.js';6import { IDataChannelService } from '../../../platform/dataChannel/common/dataChannel.js';7import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';8import { ExtHostContext, ExtHostDataChannelsShape, MainContext, MainThreadDataChannelsShape } from '../common/extHost.protocol.js';910@extHostNamedCustomer(MainContext.MainThreadDataChannels)11export class MainThreadDataChannels extends Disposable implements MainThreadDataChannelsShape {1213private readonly _proxy: ExtHostDataChannelsShape;1415constructor(16extHostContext: IExtHostContext,17@IDataChannelService private readonly _dataChannelService: IDataChannelService18) {19super();20this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDataChannels);2122this._register(this._dataChannelService.onDidSendData(e => {23this._proxy.$onDidReceiveData(e.channelId, e.data);24}));25}26}272829