@mblaney/holster 2.0.0 → 2.0.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblaney/holster",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Holster is a service that allows synchronising data between devices using Node, Deno, Bun or the browser.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/holster.js CHANGED
@@ -420,9 +420,7 @@ const Holster = opt => {
420
420
  // ctx already removed by another chained callback is ok?
421
421
  if (!ctx) return
422
422
 
423
- if (!ctx.cb) {
424
- if (!cb) return
425
-
423
+ if (!ctx.cb && cb) {
426
424
  // This (and ack) allows nested objects to set their own callbacks.
427
425
  ctx.cb = cb
428
426
  cb = null
@@ -762,10 +760,7 @@ const Holster = opt => {
762
760
  // First remove the initial listener
763
761
  wire.off(initialLex, map.get(cb))
764
762
  // Then add listener on the related node
765
- let relLex
766
- if (lex) relLex = utils.obj.put(initialLex, "#", id)
767
- else relLex = {"#": id, ".": null}
768
- wire.on(relLex, map.get(cb), false, _opt)
763
+ wire.on({"#": id, ".": null}, map.get(cb), false, _opt)
769
764
  if (_get) map.get(cb)()
770
765
  } else if (_get) {
771
766
  // Not a rel, but _get was requested, so trigger callback.
package/src/radisk.js CHANGED
@@ -58,7 +58,7 @@ const Radisk = opt => {
58
58
  // Performance logging
59
59
  const perfLog = (operation, startTime, key, size) => {
60
60
  const duration = Date.now() - startTime
61
- if (duration > 2000) {
61
+ if (duration > 3000) {
62
62
  console.log(
63
63
  `[RADISK-SLOW] ${operation}: ${duration}ms for ${key}${size ? ` (${size} bytes)` : ""}`,
64
64
  )
package/ts/src/holster.ts CHANGED
@@ -521,8 +521,7 @@ const Holster = (opt?: HolsterOptions | string | string[]): HolsterAPI => {
521
521
  const ctx = allctx.get(ctxid!)
522
522
  if (!ctx) return
523
523
 
524
- if (!ctx.cb) {
525
- if (!callback) return
524
+ if (!ctx.cb && callback) {
526
525
  ctx.cb = callback as never
527
526
  callback = undefined
528
527
  }
@@ -845,10 +844,7 @@ const Holster = (opt?: HolsterOptions | string | string[]): HolsterAPI => {
845
844
  const id = utils.rel.is(current as GraphValue)
846
845
  if (id) {
847
846
  wire.off(initialLex as never, map.get(callback)!)
848
- const relLex = (lexFilter
849
- ? utils.obj.put(initialLex as never, "#", id)
850
- : { "#": id, ".": null }) as Lex
851
- wire.on(relLex, map.get(callback)!, false, opts)
847
+ wire.on({ "#": id, ".": null } as never, map.get(callback)!, false, opts)
852
848
  if (_get) map.get(callback)!()
853
849
  } else if (_get) {
854
850
  // Not a rel, but _get was requested, so trigger callback.
package/ts/src/radisk.ts CHANGED
@@ -84,7 +84,7 @@ const Radisk = (opt: RadiskOptions) => {
84
84
 
85
85
  const perfLog = (operation: string, startTime: number, key: string, size?: number): void => {
86
86
  const duration = Date.now() - startTime
87
- if (duration > 2000) {
87
+ if (duration > 3000) {
88
88
  console.log(
89
89
  `[RADISK-SLOW] ${operation}: ${duration}ms for ${key}${size ? ` (${size} bytes)` : ""}`
90
90
  )