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

@daaku/kombat

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daaku/kombat - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

33

dist/src/index.js

@@ -221,2 +221,3 @@ import { customAlphabet } from 'nanoid';

}
const after = (timeout) => new Promise(resolve => setTimeout(resolve, timeout));
export class SyncDB {

@@ -294,10 +295,15 @@ clock;

scheduleSync(timeoutMS = 50) {
if (this.nextSync) {
clearTimeout(this.nextSync);
}
this.nextSync = setTimeout(() => {
const r = this.sync();
this.#pending.add(r);
r.finally(() => this.#pending.delete(r));
}, timeoutMS);
let p = undefined;
p = this.nextSync = (async () => {
await after(timeoutMS);
// if while waiting nextSync was changed, and no longer this promise, it
// means another one was scheduled after us. we'll let that one do the
// work instead of us.
if (p !== this.nextSync) {
return;
}
await this.sync();
})();
p.finally(() => this.#pending.delete(p));
this.#pending.add(p);
}

@@ -340,5 +346,14 @@ // Sync data to-and-from the Remote.

async settle() {
await Promise.allSettled(this.#pending.values());
let last = this.nextSync;
while (true) {
await Promise.allSettled(this.#pending.values());
// if no new sync was scheduled, or was scheduled and finished, we're done
if (last === this.nextSync) {
return;
}
// else we wait again if anything is pending
last = this.nextSync;
}
}
}
//# sourceMappingURL=index.js.map
{
"name": "@daaku/kombat",
"author": "Naitik Shah <n@daaku.org>",
"version": "2.3.0",
"version": "2.4.0",
"description": "Infrastructure for CRDT powered applications.",

@@ -6,0 +6,0 @@ "repository": "git@github.com:daaku/kombat",

Sorry, the diff of this file is not supported yet

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