Skip to content

Instantly share code, notes, and snippets.

@ypcode
Last active July 29, 2018 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypcode/bf26acbd30d63f43a3dcb2ad4bededc1 to your computer and use it in GitHub Desktop.
Save ypcode/bf26acbd30d63f43a3dcb2ad4bededc1 to your computer and use it in GitHub Desktop.
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