-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: withDevTools disabled in prod, and tree-shaking docs - add inje…
…ction token config and improve docs after review
- Loading branch information
1 parent
27d146e
commit a114fda
Showing
6 changed files
with
81 additions
and
23 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,7 @@ | ||
export * from './with-devtools.config'; | ||
export { | ||
withDevtools, | ||
patchState, | ||
updateState, | ||
Action, | ||
} from './with-devtools'; |
35 changes: 35 additions & 0 deletions
35
libs/ngrx-toolkit/src/lib/with-devtools/with-devtools.config.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,35 @@ | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
export type DevtoolsConfig = { | ||
logOnly: boolean; | ||
}; | ||
|
||
export const DEFAULT_DEVTOOLS_CONFIG: DevtoolsConfig = { | ||
logOnly: false, | ||
}; | ||
|
||
export const DEVTOOLS_CONFIG = new InjectionToken<DevtoolsConfig>('DEVTOOLS_CONFIG'); | ||
|
||
|
||
/** | ||
* Provide a custom configuration for the devtools. | ||
* @param config The custom configuration. | ||
* | ||
* @example | ||
* ```ts | ||
* provideStoreDevtoolsConfig({ | ||
* logOnly: !isDevMode(), // Enable the log-only mode when not in production. (Default: false) | ||
* }); | ||
* ``` | ||
* | ||
* @returns The provider of the custom configuration. | ||
*/ | ||
export const provideStoreDevtoolsConfig = (config: Partial<DevtoolsConfig>) => { | ||
return { | ||
provide: DEVTOOLS_CONFIG, | ||
useValue: { | ||
...DEFAULT_DEVTOOLS_CONFIG, | ||
...config, | ||
} satisfies DevtoolsConfig, | ||
}; | ||
} |
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