298
299
} else {
300
>
const child = new InstantiationService(undefined, this._strict, this, this._enableTracing);
instantiationService.ts
301
>
child._globalGraphImplicitDependency = String(id);
302
>
303
>
type EaryListenerData = {
304
>
listener: Parameters<Event<any>>;
305
>
disposable?: IDisposable;
306
>
};
307
>
308
>
// Return a proxy object that's backed by an idle value. That
309
>
// strategy is to instantiate services in our idle time or when actually
310
>
// needed but not when injected into a consumer
311
>
312
>
// return "empty events" when the service isn't instantiated yet
313
>
const earlyListeners = new Map<string, LinkedList<EaryListenerData>>();
314
>
315
>
const idle = new GlobalIdleValue<any>(() => {
316
>
const result = child._createInstance<T>(ctor, args, _trace);
317
>
318
>
// early listeners that we kept are now being subscribed to
319
>
// the real service
320
>
for (const [key, values] of earlyListeners) {
321
// eslint-disable-next-line local/code-no-any-casts
322
const candidate = <Event<any>>(<any>result)[key];