Skip to content

Commit

Permalink
Add hot reloading readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jordangarcia committed Dec 23, 2015
1 parent 04f676b commit 4140ae4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
38 changes: 38 additions & 0 deletions examples/hot-reloading/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
NuclearJS Hot Reloading
===

NuclearJS supports hot reloading of stores. Using the webpack Hot Module Replacement simply code like this to wherever your stores are registered.


```js
import { Reactor } from 'nuclear-js'
import * as stores from './stores'

const reactor = new Reactor({
debug: true,
})
reactor.registerStores(stores)

if (module.hot) {
// Enable webpack hot module replacement for stores
module.hot.accept('./stores', () => {
reactor.replaceStores(require('./stores'))
})
}

export default reactor
```

## Running Example

```
npm install
npm start
```

Go to [http://localhost:3000](http://localhost:3000)

## Inpsiration & Thanks

Big thanks to [redux](https://github.com/rackt/redux) and [react-redux](https://github.com/rackt/react-redux) for proving out this architecture
and creating simple APIs to accomplish hot reloading.
25 changes: 0 additions & 25 deletions examples/hot-reloading/npm-debug.log

This file was deleted.

2 changes: 1 addition & 1 deletion examples/hot-reloading/src/reactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const reactor = new Reactor({
reactor.registerStores(stores)

if (module.hot) {
// Enable Webpack hot module replacement for reducers
// Enable Webpack hot module replacement for stores
module.hot.accept('./stores', () => {
reactor.replaceStores(require('./stores'))
})
Expand Down

0 comments on commit 4140ae4

Please sign in to comment.