From 12600453a7bdd89c7d12b8d761887f7004b647e3 Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Tue, 11 Sep 2018 13:07:58 -0500 Subject: [PATCH] FRPtools container hash function is now optional --- packages/frptools/README.md | 4 ++-- packages/frptools/package.json | 2 +- packages/frptools/src/container.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/frptools/README.md b/packages/frptools/README.md index 60102e1..8d99e75 100644 --- a/packages/frptools/README.md +++ b/packages/frptools/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/packages/frptools/package.json b/packages/frptools/package.json index 1ee960c..0ccd469 100644 --- a/packages/frptools/package.json +++ b/packages/frptools/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/packages/frptools/src/container.js b/packages/frptools/src/container.js index fdeda92..e926d42 100644 --- a/packages/frptools/src/container.js +++ b/packages/frptools/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); }