-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import ServiceProvider from "./ServiceProvider"; | ||
import ServiceProviderConstructor from "./ServiceProviderConstructor"; | ||
|
||
|
||
/** | ||
* Service Registrar | ||
* | ||
* Able to register and boot service providers. | ||
*/ | ||
export default interface Registrar | ||
{ | ||
/** | ||
* Register a service provider | ||
* | ||
* @param {ServiceProvider | ServiceProviderConstructor} provider | ||
* @param {boolean} [boot=true] | ||
* | ||
* @returns {Promise<boolean>} False if already registered | ||
* | ||
* @async | ||
*/ | ||
register(provider: ServiceProvider | ServiceProviderConstructor, boot?: boolean): Promise<boolean>; | ||
|
||
/** | ||
* Register multiple service providers | ||
* | ||
* @param {(ServiceProvider | ServiceProviderConstructor)[]} providers | ||
* @param {boolean} [boot=true] | ||
* @param {boolean} [safe=true] If true, given providers are only booted after all providers have been registered. | ||
* | ||
* @returns {Promise<boolean>} | ||
*/ | ||
registerMultiple(providers: (ServiceProvider | ServiceProviderConstructor)[], boot?: boolean, safe?: boolean): Promise<boolean>; | ||
|
||
/** | ||
* Determine if service provider has already been registered | ||
* | ||
* @param {ServiceProvider | ServiceProviderConstructor} provider | ||
* | ||
* @returns {boolean} | ||
*/ | ||
isRegistered(provider: ServiceProvider | ServiceProviderConstructor): boolean | ||
|
||
/** | ||
* Get the service providers that are registered | ||
* | ||
* @returns {ServiceProvider[]} | ||
*/ | ||
get registered(): ServiceProvider[]; | ||
|
||
/** | ||
* Boot given service provider | ||
* | ||
* @param {ServiceProvider} provider | ||
* | ||
* @returns {Promise<boolean>} False if provider has already been booted | ||
* | ||
* @async | ||
*/ | ||
boot(provider: ServiceProvider): Promise<boolean>; | ||
|
||
/** | ||
* Boots all given service providers | ||
* | ||
* **Note**: _Method skips providers that have already been booted!_ | ||
* | ||
* @param {ServiceProvider[]} providers | ||
* | ||
* @returns {Promise<boolean>} | ||
* | ||
* @async | ||
*/ | ||
bootMultiple(providers: ServiceProvider[]): Promise<boolean>; | ||
|
||
/** | ||
* Determine if service provider has already been booted | ||
* | ||
* @param {ServiceProvider} provider | ||
* | ||
* @returns {boolean} | ||
*/ | ||
hasBooted(provider: ServiceProvider): boolean; | ||
|
||
/** | ||
* Get the service providers that have been booted | ||
* | ||
* @returns {ServiceProvider[]} | ||
*/ | ||
get booted(): ServiceProvider[]; | ||
|
||
/** | ||
* Resolves service provider | ||
* | ||
* @param {ServiceProvider | ServiceProviderConstructor} provider | ||
* | ||
* @returns {ServiceProvider} Resolved service provider instance | ||
* | ||
* @throws {RegistrationException} | ||
*/ | ||
resolveProvider(provider: ServiceProvider | ServiceProviderConstructor): ServiceProvider; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters