The Wayback Machine - https://web.archive.org/web/20190322181852/https://github.com/optimizely/nuclear-js/releases
Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

@jordangarcia jordangarcia released this Sep 21, 2016 · 12 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

Assets 2

@jordangarcia jordangarcia released this Jan 4, 2016 · 34 commits to master since this release

1.3.0 (December 31, 2015)

  • [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.
  • [NEW] Support for more granular options for logging and triggering invariants in the NuclearJS runtime. See API Docs for details.
Assets 2
Jan 4, 2016

show

Merge pull request #204 from optimizely/jordan/release-1.3.0
[release] 1.3.0

@jordangarcia jordangarcia released this Nov 5, 2015 · 53 commits to master since this release

Changes

  • [FIXED] Observers of the entire app state not triggering on actions from a late registered store
Assets 2

@jordangarcia jordangarcia released this Nov 2, 2015 · 57 commits to master since this release

A complete functional refactor of NuclearJS's evaluation and observation mechanisms, solving all of the frustrating cache collision issues while also making observation much more efficient in cases where the number of stores changing is low.

Changes

  • [NEW] Exposed new API methods: batchStart and batchStop.
  • [NEW] Changed the transpiler to Babel.
  • [FIXED] Completely refactored Reactor, Evaluator and ChangeObserver.
  • [FIXED] Fixed all issues related to hash code collisions.
  • [FIXED] Refactored how change observation works to be much more efficient.

Shoutouts

Bigs thanks to @lyonlai and @bhamodi for helping with this release!

Assets 2

@bhamodi bhamodi released this Oct 24, 2015

  • [FIXED] Fix for observer iteration when removed during notify. Issue #151
Assets 2

@jordangarcia jordangarcia released this Jul 27, 2015 · 123 commits to master since this release

  • [ADDED] Bowser support via bower.json
Assets 2

@jordangarcia jordangarcia released this Jul 23, 2015 · 128 commits to master since this release

  • [NEW] added Reactor#serialize, Reactor#loadState, Store#serialize and Store#deserialize methods
  • [NEW] added Reactor#batch to allow batch dispatches before notify observers
  • [NEW] throw error when trying to dispatch within a dispatch
  • [FIXED] fix Evaluator locking if getter evaluation errors

Isomorphic Story

NuclearJS now supports server side rendering better than ever with NuclearJS React Addons.

To see this in action, check out the Isomorphic Flux Chat Example.

API Additions

Reactor#serialize()

Returns a plain JavaScript object representing the application state. By default this maps over all stores and returns toJS(storeState).

reactor.loadState(reactor.serialize())

Reactor#loadState( state )

Takes a plain JavaScript object and merges into the reactor state, using store.deserialize

This can be useful if you need to load data already on the page.

reactor.loadState({
  stringStore: 'bar',
  listStore: [4,5,6],
})

Store#serialize

Serialization method for the store's data, by default its implemented as `Nuclear.toJS' which converts ImmutableJS objects to plain JavaScript.
This is overridable for your specific data needs.

// serializing an Immutable map while preserving numerical keys
Nuclear.Store({
  // ...
  serialize(state) {
    if (!state) {
      return state;
    }
    return state.entrySeq().toJS()
  },
  // ...
})

Store#deserialize

Serialization method for the store's data, by default its implemented as `Nuclear.toImmutable' which converts plain JavaScript objects to ImmutableJS data structures.
This is overridable for your specific data needs.

// deserializing an array of arrays [[1, 'one'], [2, 'two']] to an Immutable.Map
Nuclear.Store({
  // ...
  deserialize(state) {
    return Immutable.Map(state)
  },
  // ...
})

Shoutouts

Huge thanks to @Sinewyk for spearheading all of the isomorphic work and updating the examples.

Also big things to @bhamodi @balloob @mark-rushakoff @kurumpa for their contributions this release.

Assets 2
Pre-release

@jordangarcia jordangarcia released this Jul 4, 2015 · 202 commits to master since this release

  • [NEW] added Reactor#serialize, Reactor#loadState, Store#serialize and Store#deserialize methods
  • [NEW] added Reactor#batch to allow batch dispatches before notify observers
  • [FIXED] fix Evaluator locking if getter evaluation errors

API Additions

Reactor#serialize()

Returns a plain javascript object representing the application state. By defualt this maps over all stores and returns toJS(storeState).

reactor.loadState(reactor.serialize())

Reactor#loadState( state )

Takes a plain javascript object and merges into the reactor state, using store.deserialize

This can be useful if you need to load data already on the page.

reactor.loadState({
  stringStore: 'bar',
  listStore: [4,5,6],
})

Store#serialize

Serialization method for the store's data, by default its implemented as `Nuclear.toJS' which converts ImmutableJS objects to plain javascript.
This is overridable for your specific data needs.

// serializing an Immutable map while preserving numerical keys
Nuclear.Store({
  // ...
  serialize(state) {
    if (!state) {
      return state;
    }
    return state.entrySeq().toJS()
  },
  // ...
})

Store#deserialize

Serialization method for the store's data, by default its implemented as `Nuclear.toImmutable' which converts plain javascript objects to ImmutableJS data structures.
This is overridable for your specific data needs.

// deserializing an array of arrays [[1, 'one'], [2, 'two']] to an Immutable.Map
Nuclear.Store({
  // ...
  deserialize(state) {
    return Immutable.Map(state)
  },
  // ...
})
Assets 2
Jul 2, 2015
Implement Reactor#serialize and Reactor#loadState methods
You can’t perform that action at this time.