Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

1.4.0

Latest

Choose a tag to compare

@jordangarcia jordangarcia released this 21 Sep 19:25
· 29 commits to master since this release

1.4.0 (September 21, 2016)

  • [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
  • [NEW] Add ability to supply your own logger and override the default console group logger in NuclearJS
  • [UPGRADE] Upgrade immutable to 3.8.1

Cache Configuration

import * as Nuclear from 'nuclear-js';

const MAX_ITEMS = 1000 // (optional, default = 1000) how many items to keep in the LRU cache before evicting
const EVICT_COUNT = 10 // (optional, default = 1) how many items to throw out when the cache fills up

new Nuclear.Reactor({
  debug: false,
  cache: new Nuclear.LRUCache(MAX_ITEMS, EVICT_COUNT),
});

Using your own Logger

import * as Nuclear from 'nuclear-js';

new Nuclear.Reactor({
  logger: {
    dispatchStart(reactorState, actionType, payload) {
      console.log(`dispatch: actionType=${actionTypes}`, payload)
    },
    dispatchError(reactorState, error) {
      // useful if you need to close a console.group if an error is thrown during dispatch
    },
    dispatchEnd(reactorState, state, dirtyStores, previousState) {
      const prevStateChanges = previousState.filter((val, key) => dirtyStores.contains(key)).toJS()
      const stateChanges = state.filter((val, key) => dirtyStores.contains(key)).toJS()

      console.log('prev state: ', prevStateChanges)
      console.log('new state: ', stateChanges)
    },
  },
});

Big thanks to

@loganlinn @niftymonkey @gerges @andrei-cacio @raulmatei @lchski

Morty Proxy This is a proxified and sanitized view of the page, visit original site.