Replies: 2 comments
-
Services (aka providers) are by default only initialized when they're being requested as a dependency. class SomeModule extends createModule({}) {
process() {
if (someConstraint) {
this.addProvider(SomeService);
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you mean with initialise that the service should just be instantiated, you should just register them on a onAppExecute or onServerBootstrap event. class MyService {}
new App({
providers: [MyService],
listeners: [
onAppExecute.listen((event, service: MyService) => {}),
]
}).run(); if it should initialize stuff async: class MyService {
async initialize() {
// do some stuff
}
}
new App({
providers: [MyService],
listeners: [
onAppExecute.listen(async (event, service: MyService) => {
await service.initialize();
}),
]
}).run(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
as title
Beta Was this translation helpful? Give feedback.
All reactions