statebus 6.1.23 → 6.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/statebus.js +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "statebus",
3
- "version": "6.1.23",
3
+ "version": "6.1.26",
4
4
  "description": "Synchronize state.",
5
5
  "main": "statebus.js",
6
6
  "scripts": {
package/statebus.js CHANGED
@@ -430,9 +430,11 @@
430
430
  statelog(key, yellow, 'v', 'Deleting ' + key)
431
431
  // Call the to_delete handlers
432
432
  var handlers_called = bus.route(key, 'to_delete', key)
433
- if (handlers_called === 0)
433
+ if (handlers_called === 0) {
434
434
  // And go ahead and delete if there aren't any!
435
435
  delete cache[key]
436
+ delete backup_cache[key]
437
+ }
436
438
 
437
439
  // Call the on_delete handlers
438
440
  bus.route(key, 'on_delete', cache[key] || {key: key}, t)
@@ -828,9 +830,10 @@
828
830
  // except through an explicit .revise() function.
829
831
  if (o) t.version = new_version()
830
832
 
831
- if (method === 'to_delete')
833
+ if (method === 'to_delete') {
832
834
  delete bus.cache[key]
833
- else if (method === 'to_save') {
835
+ delete bus.backup_cache[key]
836
+ } else if (method === 'to_save') {
834
837
  bus.save.fire(o || arg, t)
835
838
  bus.route(key, 'on_set_sync', o || arg, t)
836
839
  } else {
@@ -1742,7 +1745,10 @@
1742
1745
  client_fetched_keys.add(key) }
1743
1746
  bus(prefix).to_forget = function (key) { send({forget: key}),
1744
1747
  client_fetched_keys.delete(key) }
1745
- bus(prefix).to_delete = function (key) { send({'delete': key}) }
1748
+ bus(prefix).to_delete = function (key, t) {
1749
+ t.done()
1750
+ send({'delete': key})
1751
+ }
1746
1752
 
1747
1753
  function connect () {
1748
1754
  nlog('[ ] trying to open ' + url)