diff --git a/README.md b/README.md index 60102e1..8d99e75 100644 --- a/README.md +++ b/README.md @@ -190,8 +190,8 @@ them. ## Behavior Anytime a property is set or a method is gotten and called, the container will check for an updated -state and trigger subscribers if it is updated. An hash function must be applied to determine -updated status. +state and trigger subscribers if it is updated. An optional hash function may be applied to +determine updated status. If the hash function is not supplied, every update will be propagated. ## Usage diff --git a/package.json b/package.json index 1ee960c..0ccd469 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frptools", - "version": "3.2.2", + "version": "3.2.3", "description": "Observable Property and Computed data streams", "main": "src/index.js", "files": [ diff --git a/src/container.js b/src/container.js index fdeda92..e926d42 100644 --- a/src/container.js +++ b/src/container.js @@ -2,7 +2,7 @@ import { registerSubscriptions, registerFire } from './util.js'; export function container(store, hash) { let subscribers = []; - let id = hash(store); + let id = hash && hash(store); const containerMethods = { subscribe: registerSubscriptions(subscribers), @@ -13,8 +13,8 @@ export function container(store, hash) { }; function checkUpdate(target) { - const newId = hash(target); - if (id !== newId) { + let newId = hash && hash(target); + if (!hash || id !== newId) { id = newId; containerMethods.fire(target); }