@sussudio/platform
Version:
Internal APIs for VS Code's service injection the base services.
30 lines (28 loc) • 1.3 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SyncDescriptor } from './descriptors';
import { BrandedService, ServiceIdentifier } from './instantiation';
export declare const enum InstantiationType {
/**
* Instantiate this service as soon as a consumer depdends on it. _Note_ that this
* is more costly as some upfront work is done that is likely not needed
*/
Eager = 0,
/**
* Instantiate this service as soon as a consumer uses it. This is the _better_
* way of registering a service.
*/
Delayed = 1,
}
export declare function registerSingleton<T, Services extends BrandedService[]>(
id: ServiceIdentifier<T>,
ctor: new (...services: Services) => T,
supportsDelayedInstantiation: InstantiationType,
): void;
export declare function registerSingleton<T, Services extends BrandedService[]>(
id: ServiceIdentifier<T>,
descriptor: SyncDescriptor<any>,
): void;
export declare function getSingletonServiceDescriptors(): [ServiceIdentifier<any>, SyncDescriptor<any>][];