This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: reconstruct module and reorganize rxjs
- Loading branch information
1 parent
5963e39
commit 6f90fdd
Showing
5 changed files
with
29 additions
and
27 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,16 @@ | ||
import { NgModule, Optional, SkipSelf } from '@angular/core'; | ||
import { throwIfAlreadyLoaded } from './module-import-guard'; | ||
|
||
@NgModule({ | ||
imports: [], | ||
declarations: [], | ||
}) | ||
export class CoreModule { | ||
constructor( | ||
@Optional() | ||
@SkipSelf() | ||
parentModule: CoreModule, | ||
) { | ||
throwIfAlreadyLoaded(parentModule, 'CoreModule'); | ||
} | ||
} |
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,7 @@ | ||
export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) { | ||
if (parentModule) { | ||
throw new Error( | ||
`${moduleName} has already been loaded. Import Core modules in the AppModule only.`, | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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