Pull render service off instantiation service safely
This commit is contained in:
@@ -36,7 +36,7 @@ export class ServiceCollection {
|
||||
return this._entries.has(id);
|
||||
}
|
||||
|
||||
get<T>(id: IServiceIdentifier<T>): T {
|
||||
get<T>(id: IServiceIdentifier<T>): T | undefined {
|
||||
return this._entries.get(id);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,10 @@ export class InstantiationService implements IInstantiationService {
|
||||
this._services.set(id, instance);
|
||||
}
|
||||
|
||||
public getService<T>(id: IServiceIdentifier<T>): T | undefined {
|
||||
return this._services.get(id);
|
||||
}
|
||||
|
||||
public createInstance<T>(ctor: any, ...args: any[]): any {
|
||||
const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ export interface IConstructorSignature8<A1, A2, A3, A4, A5, A6, A7, A8, T> {
|
||||
export const IInstantiationService = createDecorator<IInstantiationService>('InstantiationService');
|
||||
export interface IInstantiationService {
|
||||
setService<T>(id: IServiceIdentifier<T>, instance: T): void;
|
||||
getService<T>(id: IServiceIdentifier<T>): T | undefined;
|
||||
|
||||
createInstance<T>(ctor: IConstructorSignature0<T>): T;
|
||||
createInstance<A1, T>(ctor: IConstructorSignature1<A1, T>, first: A1): T;
|
||||
|
||||
Reference in New Issue
Block a user