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

@logux/client

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logux/client - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

4

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 0.5
* Rename `Client#id` to `Client#tabId`.
* Trim re-send meta keys (`users`, `channels`) during synchronization.
## 0.4

@@ -5,0 +9,0 @@ * Add `Client#on` method to unify API with `CrossTabClient`.

20

client.js

@@ -10,4 +10,4 @@ var isFirstOlder = require('@logux/core/is-first-older')

function tabPing (client) {
localStorage.setItem(client.options.prefix + ':tab:' + client.id, Date.now())
function tabPing (c) {
localStorage.setItem(c.options.prefix + ':tab:' + c.tabId, Date.now())
}

@@ -35,3 +35,3 @@

var ALLOWED_META = ['id', 'time', 'nodes', 'users', 'clients', 'channels']
var ALLOWED_META = ['id', 'time']

@@ -133,8 +133,8 @@ /**

* @example
* app.log.add(action, { tab: app.id })
* app.log.add(action, { tab: app.tabId })
*/
this.id = nanoid(8)
this.tabId = nanoid(8)
} else {
this.id = this.options.time.lastId + 1 + ''
this.clientId = this.options.userId + ':' + this.id
this.tabId = this.options.time.lastId + 1 + ''
this.clientId = this.options.userId + ':' + this.tabId
}

@@ -149,3 +149,3 @@

*/
this.nodeId = this.clientId + ':' + this.id
this.nodeId = this.clientId + ':' + this.tabId

@@ -258,3 +258,3 @@ var auth

this.tabTimeout = 10 * this.tabPing
var reason = 'tab' + client.id
var reason = 'tab' + client.tabId
if (this.isLocalStorage) {

@@ -436,3 +436,3 @@ var unbind = log.on('add', function (action, meta) {

onUnload: function onUnload () {
if (this.pinging) cleanTabActions(this, this.id)
if (this.pinging) cleanTabActions(this, this.tabId)
},

@@ -439,0 +439,0 @@

@@ -22,3 +22,3 @@ var merge = require('@logux/core/merge')

function leaderPing (client) {
sendToTabs(client, 'leader', [client.id, Date.now()])
sendToTabs(client, 'leader', [client.tabId, Date.now()])
}

@@ -89,3 +89,3 @@

var data = getLeader(client, 'leader')
if (data[0] === client.id) {
if (data[0] === client.tabId) {
setRole(client, 'leader')

@@ -200,4 +200,4 @@ } else {

client.emitter.emit('add', action, meta)
if (meta.tab !== client.id) {
sendToTabs(client, 'add', [client.id, action, meta])
if (meta.tab !== client.tabId) {
sendToTabs(client, 'add', [client.tabId, action, meta])
}

@@ -207,4 +207,4 @@ })

client.emitter.emit('clean', action, meta)
if (meta.tab !== client.id) {
sendToTabs(client, 'clean', [client.id, action, meta])
if (meta.tab !== client.tabId) {
sendToTabs(client, 'clean', [client.tabId, action, meta])
}

@@ -297,4 +297,4 @@ })

data = JSON.parse(e.newValue)
if (data[0] !== this.id) {
if (!data[2].tab || data[2].tab === this.id) {
if (data[0] !== this.tabId) {
if (!data[2].tab || data[2].tab === this.tabId) {
if (isMemory(this.log.store)) {

@@ -311,4 +311,4 @@ this.log.store.add(data[1], data[2])

data = JSON.parse(e.newValue)
if (data[0] !== this.id) {
if (!data[2].tab || data[2].tab === this.id) {
if (data[0] !== this.tabId) {
if (!data[2].tab || data[2].tab === this.tabId) {
if (isMemory(this.log.store)) {

@@ -324,3 +324,3 @@ this.log.store.remove(data[2].id)

onDeadLeader(this)
} else if (data[0] !== this.id && this.role !== 'candidate') {
} else if (data[0] !== this.tabId && this.role !== 'candidate') {
setRole(this, 'follower')

@@ -327,0 +327,0 @@ watchForLeader(this)

@@ -111,3 +111,3 @@ var browserSupportsLogStyles = require('browser-supports-log-styles')

unbind.push(client.on('add', function (action, meta) {
if (meta.tab && meta.tab !== client.id) return
if (meta.tab && meta.tab !== client.tabId) return
if (ignore[action.type]) return

@@ -114,0 +114,0 @@ var message

{
"name": "@logux/client",
"version": "0.4.0",
"version": "0.5.0",
"description": "Logux base components to build web client",

@@ -16,6 +16,6 @@ "keywords": [

"dependencies": {
"@logux/core": "^0.3.2",
"@logux/core": "^0.3.3",
"browser-supports-log-styles": "^1.1.7",
"nanoevents": "^2.0.0",
"nanoid": "^2.1.0"
"nanoid": "^2.1.1"
},

@@ -26,4 +26,4 @@ "eslintIgnore": [

"sharec": {
"version": "0.4.3"
"version": "0.4.4"
}
}
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