1142
1143
export function fromService<TContext>(service: unknown, disposables: DisposableStore, options?: ICreateServiceChannelOptions): IServerChannel<TContext> {
1144
>
const handler = service as { [key: string]: unknown };
ipc.ts
1145
>
const disableMarshalling = options?.disableMarshalling;
1146
>
1147
>
// Buffer any event that should be supported by
1148
>
// iterating over all property keys and finding them
1149
>
// However, this will not work for services that
1150
>
// are lazy and use a Proxy within. For that we
1151
>
// still need to check later (see below).
1152
>
const mapEventNameToEvent = new Map<string, Event<unknown>>();
1153
>
for (const key in handler) {
1154
>
if (propertyIsEvent(key)) {
1155
>
mapEventNameToEvent.set(key, Event.buffer(handler[key] as Event<unknown>, key, true, undefined, disposables));
1156
>
}
1157
>
}
1158
>
1159
>
return new class implements IServerChannel {
1160
>
1161
>
listen<T>(_: unknown, event: string, arg: any): Event<T> {
1162
const eventImpl = mapEventNameToEvent.get(event);
1163
if (eventImpl) {