New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dexie-relay

Package Overview
Dependencies
Maintainers
0
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dexie-relay - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

54

index.js

@@ -13,2 +13,6 @@ import {Client} from 'relay-to-relay'

this.keep = opts.keep === true ? opts.keep : false
this.timer = typeof(opts.timer) === 'object' && !Array.isArray(opts.timer) ? opts.timer : {}
this.timer.redo = this.timer.redo || 180000
this.timer.expire = this.timer.expire || 300000

@@ -41,16 +45,2 @@ this.user = localStorage.getItem('user') || (() => {const test = crypto.randomUUID();localStorage.setItem('user', test);return test;})()

this.db.version(opts.version).stores(opts.schema)
this.adds = new Set()
this.edits = new Map()
this.subs = new Set()
this.routine = setInterval(() => {
this.adds.clear()
for(const [prop, update] of this.edits.entries()){
if((Date.now() - update) > 300000){
this.edits.delete(prop)
}
}
this.subs.clear()
}, 180000)

@@ -63,2 +53,16 @@ this.client.on('connect', this.#connect)

#adds = new Set()
#edits = new Map()
#subs = new Set()
#routine = setInterval(() => {
this.#adds.clear()
for(const [prop, update] of this.#edits.entries()){
if((Date.now() - update) > this.timer.expire){
this.#edits.delete(prop)
}
}
this.#subs.clear()
}, this.timer.redo)
async #message(data, nick){

@@ -80,3 +84,3 @@ try {

if(datas.status === 'add'){
if(this.adds.has(datas.iden)){
if(this.#adds.has(datas.iden)){
return

@@ -86,11 +90,11 @@ }

this.emit('add', datas.iden)
this.adds.add(datas.iden)
this.#adds.add(datas.iden)
this.client.onMesh(data, nick)
} else if(datas.status === 'edit'){
if(this.edits.has(datas.iden)){
const test = this.edits.get(datas.iden)
if(this.#edits.has(datas.iden)){
const test = this.#edits.get(datas.iden)
if(datas.edit > test){
await dataTab.update(datas.iden, datas.data)
this.emit('edit', datas.iden)
this.edits.set(datas.iden, datas.edit)
this.#edits.set(datas.iden, datas.edit)
this.client.onMesh(data, nick)

@@ -103,7 +107,7 @@ } else {

this.emit('edit', datas.iden)
this.edits.set(datas.iden, datas.edit)
this.#edits.set(datas.iden, datas.edit)
this.client.onMesh(data, nick)
}
} else if(datas.status === 'sub'){
if(this.subs.has(datas.iden)){
if(this.#subs.has(datas.iden)){
return

@@ -115,3 +119,3 @@ }

}
this.subs.add(datas.iden)
this.#subs.add(datas.iden)
this.client.onMesh(data, nick)

@@ -307,4 +311,6 @@ } else {

quit(){
clearInterval(this.routine)
this.edits.clear()
clearInterval(this.#routine)
this.#adds.clear()
this.#edits.clear()
this.#subs.clear()
this.client.off('connect', this.#connect)

@@ -311,0 +317,0 @@ this.client.off('error', this.#err)

{
"name": "dexie-relay",
"version": "3.0.1",
"version": "3.0.2",
"main": "index.js",

@@ -5,0 +5,0 @@ "scripts": {

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