MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / subscribe

Function subscribe

Extension/src/Utility/Eventing/emitter.ts:258–269  ·  view source on GitHub ↗
(...subscribers: string[] | Subscription<T>[])

Source from the content-addressed store, hash-verified

256 subscribe<T>(...subscribers: string[]): Promise<void>;
257 subscribe<T extends Record<string, any>>(...subscribers: Subscription<T>[]): void;
258 subscribe<T extends Record<string, any>>(...subscribers: string[] | Subscription<T>[]): void | Promise<void> {
259 if (subscribers.length === 0) {
260 return subscribe(this as unknown as Subscription, { eventSource: this }) && undefined;
261 }
262 if (typeof subscribers[0] === 'string') {
263 return Promise.all(subscribers.map(each => subscribe(each as string, { eventSource: this }))) as unknown as Promise<void>;
264 }
265
266 for (const each of subscribers as ArbitraryObject[]) {
267 subscribe(each, { eventSource: this });
268 }
269 }
270
271 removeAllListeners() {
272 removeAllListeners(this);

Callers

nothing calls this directly

Calls 2

subscribeFunction · 0.90
allMethod · 0.65

Tested by

no test coverage detected