-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(loader): lifecycle loader support named export
- Loading branch information
1 parent
fed9fba
commit 75ce365
Showing
3 changed files
with
55 additions
and
24 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
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
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,37 @@ | ||
import { | ||
ArtusApplication, | ||
ApplicationLifecycle, LifecycleHookUnit, LifecycleHook, ArtusInjectEnum, | ||
} from '../../../src/index'; | ||
|
||
import { Container, Inject } from '@artus/injection'; | ||
import LifecycleList from './lifecyclelist'; | ||
|
||
@LifecycleHookUnit() | ||
export class AppReadyLifecycle implements ApplicationLifecycle { | ||
@Inject(ArtusInjectEnum.Application) | ||
app: ArtusApplication; | ||
|
||
@Inject() | ||
container: Container; | ||
|
||
@Inject() | ||
lifecycleList: LifecycleList; | ||
|
||
@LifecycleHook('willReady') | ||
async willReady() { | ||
await new Promise(resolve => setTimeout(resolve, 100)); | ||
this.lifecycleList.add('app_willReady'); | ||
} | ||
|
||
@LifecycleHook('didReady') | ||
async didReady() { | ||
await new Promise(resolve => setTimeout(resolve, 100)); | ||
this.lifecycleList.add('app_didReady'); | ||
} | ||
|
||
@LifecycleHook() | ||
async beforeClose() { | ||
await new Promise(resolve => setTimeout(resolve, 100)); | ||
this.lifecycleList.add('app_beforeClose'); | ||
} | ||
} |