-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support getCurrentApplicationContext API (#981)
* refactor: support getCurrent API * fix: lint
- Loading branch information
1 parent
099e76c
commit dd6ce11
Showing
5 changed files
with
54 additions
and
2 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
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,21 @@ | ||
import { | ||
IConfigurationOptions, | ||
IMidwayApplication, | ||
IMidwayContainer, | ||
IMidwayFramework, | ||
} from '../interface'; | ||
|
||
export const getCurrentApplicationContext = (): IMidwayContainer => { | ||
return getCurrentMainFramework().getApplicationContext(); | ||
}; | ||
|
||
export const getCurrentMainFramework = < | ||
APP extends IMidwayApplication, | ||
T extends IConfigurationOptions | ||
>(): IMidwayFramework<APP, T> => { | ||
return global['MIDWAY_MAIN_FRAMEWORK'] as IMidwayFramework<APP, T>; | ||
}; | ||
|
||
export const getCurrentMainApp = <APP extends IMidwayApplication>(): APP => { | ||
return getCurrentMainFramework().getApplication() as APP; | ||
}; |
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