-
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: should call config hook in idle callback (#218)
* fix: should call confighook in idle callback * feat: add PULL_REQUEST_TEMPLATE.md * chore: remove pr template * fix: add didLoad event * fix: trigger loader with order * fix: compatitble for custom loader * fix: add config dir * chore: remove useless comment
- Loading branch information
Showing
7 changed files
with
106 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { LifecycleHookUnit, LifecycleHook } from '../../../src/decorator'; | ||
import { ApplicationLifecycle } from '../../../src/types'; | ||
import { Container, Inject } from '@artus/injection'; | ||
import LifecycleList from './lifecyclelist'; | ||
|
||
@LifecycleHookUnit() | ||
export default class MyLifecycle implements ApplicationLifecycle { | ||
@Inject() | ||
container: Container; | ||
|
||
@Inject() | ||
lifecycleList: LifecycleList; | ||
|
||
@LifecycleHook() | ||
async configWillLoad() { | ||
this.lifecycleList.add('configWillLoad'); | ||
} | ||
|
||
@LifecycleHook() | ||
async configDidLoad() { | ||
this.lifecycleList.add('configDidLoad'); | ||
} | ||
|
||
@LifecycleHook() | ||
async willReady() { | ||
this.lifecycleList.add('willReady'); | ||
} | ||
|
||
@LifecycleHook() | ||
async didLoad() { | ||
this.lifecycleList.add('didLoad'); | ||
} | ||
|
||
@LifecycleHook('didReady') | ||
async didReady() { | ||
this.lifecycleList.add('didReady'); | ||
} | ||
|
||
@LifecycleHook() | ||
async beforeClose() { | ||
this.lifecycleList.add('beforeClose'); | ||
} | ||
} |
Empty file.
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,12 @@ | ||
import { Injectable, ScopeEnum } from '../../../src'; | ||
|
||
@Injectable({ | ||
scope: ScopeEnum.SINGLETON, | ||
}) | ||
export default class LifecycleList { | ||
lifecycleList: string[] = []; | ||
|
||
async add(name: string) { | ||
this.lifecycleList.push(name); | ||
} | ||
} |
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,4 @@ | ||
{ | ||
"name": "demo-app-repo-ts", | ||
"main": "src/index.ts" | ||
} |
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,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"experimentalDecorators": true | ||
}, | ||
"rootDir": "./", | ||
"exclude": [] | ||
} |
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