https://github.com/CodeSequence/ngrx-store-hmr
Experimental HMR support for @ngrx/store
https://github.com/CodeSequence/ngrx-store-hmr
Last synced: 2 months ago
JSON representation
Experimental HMR support for @ngrx/store
- Host: GitHub
- URL: https://github.com/CodeSequence/ngrx-store-hmr
- Owner: CodeSequence
- Archived: true
- Created: 2016-03-21T13:12:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-17T15:23:22.000Z (about 9 years ago)
- Last Synced: 2024-11-10T15:45:37.907Z (8 months ago)
- Language: TypeScript
- Size: 4.88 KB
- Stars: 20
- Watchers: 7
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @ngrx/store HMR
Experimental HMR support for [@ngrx/store](https://github.com/ngrx/store) based on [angular2-hmr](https://github.com/gdi2290/angular2-hmr)## Setup
First install the library:
```
npm install ngrx-store-hmr --save-dev
```In order for your application to have HMR support, you need to wrap your bootstrap call in a function that receives an optional HMR state object:
```ts
import { provideStore } from '@ngrx/store';
import { hotModuleReplacement } from 'ngrx-store-hmr';
import { reducer } from './reducer';// Wrap bootstrap in a function that accept an optional hmrState
function main(hmrState?: any) {
return bootstrapp(App, [
provideStore(reducer, hmrState)
]);
}if(module.hot) {
hotModuleReplacement(main, module);
}
else {
document.addEventListener('DOMContentLoaded', () => main);
}
```