Skip to content

Commit 4e26bcf

Browse files
committed
Prep for 1.4.0 release
1 parent 5f9353c commit 4e26bcf

File tree

8 files changed

+2420
-2053
lines changed

8 files changed

+2420
-2053
lines changed

CHANGELOG.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
## 1.4.0 (September 21, 2015)
2+
3+
4+
- **[NEW]** Added ability to switch out the default caching strategy for caching getter values. Also expose an LRU cache that can be swapped in for the basic cache
5+
- **[NEW]** Add ability to supply your own logger and override the default console group logger in NuclearJS
6+
- **[UPGRADE]** Upgrade `immutable` to `3.8.1`
7+
8+
9+
### Cache Configuration
10+
11+
```
12+
import * as Nuclear from 'nuclear-js';
13+
14+
const MAX_ITEMS = 1000 // (optional, default = 1000) how many items to keep in the LRU cache before evicting
15+
const EVICT_COUNT = 10 // (optional, default = 1) how many items to throw out when the cache fills up
16+
17+
new Nuclear.Reactor({
18+
debug: false,
19+
cache: new Nuclear.LRUCache(MAX_ITEMS, EVICT_COUNT),
20+
});
21+
```
22+
23+
### Using your own Logger
24+
25+
```
26+
import * as Nuclear from 'nuclear-js';
27+
28+
new Nuclear.Reactor({
29+
logger: {
30+
dispatchStart(reactorState, actionType, payload) {
31+
console.log(`dispatch: actionType=${actionTypes}`, payload)
32+
},
33+
dispatchError(reactorState, error) {
34+
// useful if you need to close a console.group if an error is thrown during dispatch
35+
},
36+
dispatchEnd(reactorState, state, dirtyStores, previousState) {
37+
const prevStateChanges = previousState.filter((val, key) => dirtyStores.contains(key)).toJS()
38+
const stateChanges = state.filter((val, key) => dirtyStores.contains(key)).toJS()
39+
40+
console.log('prev state: ', prevStateChanges)
41+
console.log('new state: ', stateChanges)
42+
},
43+
},
44+
});
45+
```
46+
47+
148
## 1.3.0 (December 31, 2015)
249

350
- **[NEW]** Store hot-reloading via `reactor.replaceStores(stores)` which replaces the implementation of a store without resetting its underlying state value. See [hot reloading example](https://github.com/optimizely/nuclear-js/tree/master/examples/hot-reloading).

0 commit comments

Comments
 (0)