Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hypertrie

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypertrie - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

16

lib/watch.js

@@ -18,5 +18,19 @@ const set = require('unordered-set')

const self = this
const feed = this._db.feed
const watchers = this._db._watchers
if (onchange) this.on('change', onchange)
set.add(this._db._watchers, this)
set.add(watchers, this)
this.update()
if (watchers.length === 1 && feed.sparse) {
feedUpdateLoop()
}
function feedUpdateLoop () {
if (self._destroyed) return
// TODO: Expose a way to cancel this update when the watcher is destroyed, since it is not ifAvailable.
feed.update(feedUpdateLoop)
}
}

@@ -23,0 +37,0 @@

2

package.json
{
"name": "hypertrie",
"version": "4.0.0",
"version": "4.0.1",
"description": "Distributed single writer key/value store",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -82,1 +82,24 @@ const tape = require('tape')

})
tape('remote watch with sparse mode and live replication', function (t) {
const db = create(null, { sparse: true })
db.ready(function () {
const clone = create(db.key, { alwaysUpdate: true, sparse: true })
// The ready triggers an update, which we do not want to trigger a watch event, so we must call this first.
clone.ready(function () {
const stream = db.replicate(true, { live: true })
stream.pipe(clone.replicate(false, { live: true })).pipe(stream)
var watcher = clone.watch(function () {
t.pass('remote watch triggered')
watcher.destroy()
t.end()
})
setTimeout(function () {
db.put('hello', 'world')
}, 50)
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc