backend-app-api: add methods accepts a backend feature factory
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
committed by
Patrik Oldsberg
parent
108728f5fe
commit
90fdcfb403
@@ -28,8 +28,8 @@ export class BackstageBackend implements Backend {
|
||||
this.#initializer = new BackendInitializer(this.#services);
|
||||
}
|
||||
|
||||
add(feature: BackendFeature): void {
|
||||
this.#initializer.add(feature);
|
||||
add(feature: BackendFeature | (() => BackendFeature)): void {
|
||||
this.#initializer.add(typeof feature === 'function' ? feature() : feature);
|
||||
}
|
||||
|
||||
async start(): Promise<void> {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
* @public
|
||||
*/
|
||||
export interface Backend {
|
||||
add(feature: BackendFeature): void;
|
||||
add(feature: BackendFeature | (() => BackendFeature)): void;
|
||||
start(): Promise<void>;
|
||||
stop(): Promise<void>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user