-
-
Save ypcode/bf26acbd30d63f43a3dcb2ad4bededc1 to your computer and use it in GitHub Desktop.
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
public onInit(): Promise<any> { | |
return ( | |
super | |
.onInit() | |
// Set the global configuration of the application | |
// This is where we will define the proper services according to the context (Local, Test, Prod,...) | |
// or according to specific settings | |
.then(() => { | |
let scope = this.context.serviceScope; | |
return new Promise((resolve, reject) => { | |
if (this.properties.config) { | |
switch (this.properties.config) { | |
case 'config2': | |
let childScope = scope.startNewChild(); | |
childScope.createAndProvide(GreetingsServiceKey, AltGreetingsService); | |
childScope.finish(); | |
usedScope = childScope; | |
break; | |
case 'config1': | |
default: | |
break; | |
} | |
} | |
scope.whenFinished(() => { | |
resolve(); | |
}); | |
}); | |
}) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment