Skip to content

Version 8.0.0

Choose a tag to compare

@nhunzaker nhunzaker released this 20 May 11:01
· 1705 commits to master since this release

Noticeable changes

  • Stores now contain the logic for how it should receive an action.
    logic is contained under send.
  • Stores now contain the logic to determine what method should resolve
    an action sent to it. This is defined in register
  • Microcosm::deserialize will now only operate on the keys provided
    by the seed object. This means that data passed into replace
    will only blow way keys provided in the data object.
  • The signaling logic for dispatching actions will throw an error if
    the action provided is not a function
  • Internalized tag, it will now lazy evaluate as actions are fired
  • Upgraded Foliage, Microcosm now contains subscribe, unsubscribe, and publish aliases for listen, ignore, and publish

Breaking Changes

  • Remove all uses of the tag module.

Changes to Stores

Before this release, stores would listen to actions using the stringified value of their functions:

var MyStore = {
  [Action.add](state, params){}
}

This was terse, however required actions to be tagged with a special helper method. It also required any module that needed access to a Store's method to also know what actions it implemented.

To address these concerns, Stores now communicate with a Microcosm using the register method:

var MyStore = {
  register() {
    return {
      [Action.add]: this.add
    }
  },
  add(state, params){}
}

Under the hood, Microcosm tags functions automatically.