Skip to content

v0.5.0: New cloneState method, remove getStore and improve subscriber

Choose a tag to compare

@mtmr0x mtmr0x released this 12 Nov 09:28
59cb6a4

It implements overall fixes and improvements, alongside with one
important feature: cloneState;

cloneState

Cloning state now makes the store untouchable, removing the old behavior
with getStore function and adding a new way of getting data from store
with great performance and even more safe. Nucleo algorithm predicts the
data model to be cloned because its contracts allow to understand the
model and create a new object in a simple deep clone using Nucleo's tree
data structure.

subscriber improvements

Now all listeners will receive a cloned state after saved in store. From
now on inside the first parameter of a listeners, the structure will be:

function listener({ contractName, data }) {
  // contractName -> a `string` containing the changed contract name
  // data -> cloned object of that new state saved to store
}

Main changes

  • add cloneState function in store creation return
  • remove getStore function from store creation return
  • send to listeners a updated cloned data with the contract name
  • improve documentation for listeners argument model
  • overall fixes in documentation
  • overall fixes in code consistency