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

@logux/vuex

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logux/vuex - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

helpers/index.cjs

5

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 0.6.0
* Add `tag` property for component to wrap multiple children and single text
* Replace shared helpers
* Update dependencies
## 0.5.1

@@ -5,0 +10,0 @@ * Add ES modules support

17

component/index.js
import {
subscribe,
unsubscribe,
unifyChannelsObject,
subscriptionsId
} from '../mixin/index.js'
subscriptionsId,
unifyChannelsObject
} from '../helpers/index.js'

@@ -63,3 +63,3 @@ let loguxComponent = {

},
render () {
render (h) {
let { isSubscribing } = this

@@ -72,3 +72,10 @@ let defaultSlot = this.$scopedSlots.default

return defaultSlot({ isSubscribing })
let vnode = defaultSlot({ isSubscribing })
// for arrays and single text nodes
if (vnode.length > 1 || !vnode[0].tag) {
return h(this.tag, {}, vnode)
}
return vnode
}

@@ -75,0 +82,0 @@ }

@@ -1,45 +0,8 @@

function unifyChannelsObject (channels) {
if (!channels) {
return [[{}, '']]
}
return channels.map(i => {
let subscription = typeof i === 'string' ? { channel: i } : i
return [subscription, JSON.stringify(subscription)]
})
}
import {
subscribe,
unsubscribe,
subscriptionsId,
unifyChannelsObject
} from '../helpers/index.js'
function subscriptionsId (subscriptions) {
return subscriptions.map(i => i[1]).sort().join(' ')
}
function subscribe (store, subscriptions) {
if (!store.subscriptions) store.subscriptions = { }
if (!store.subscribers) store.subscribers = { }
return Promise.all(subscriptions.map(i => {
let subscription = i[0]
let json = i[1]
if (!store.subscribers[json]) store.subscribers[json] = 0
store.subscribers[json] += 1
if (store.subscribers[json] === 1) {
let action = { ...subscription, type: 'logux/subscribe' }
store.subscriptions[json] = store.commit.sync(action)
}
return store.subscriptions[json]
}))
}
function unsubscribe (store, subscriptions) {
subscriptions.forEach(i => {
let subscription = i[0]
let json = i[1]
store.subscribers[json] -= 1
if (store.subscribers[json] === 0) {
let action = { ...subscription, type: 'logux/unsubscribe' }
store.log.add(action, { sync: true })
delete store.subscriptions[json]
}
})
}
let loguxMixin = {

@@ -92,8 +55,2 @@ data: () => ({

export {
loguxMixin,
subscribe,
unsubscribe,
unifyChannelsObject,
subscriptionsId
}
export { loguxMixin }
{
"name": "@logux/vuex",
"version": "0.5.1",
"version": "0.6.0",
"description": "Vuex compatible API for Logux",

@@ -24,3 +24,3 @@ "keywords": [

"dependencies": {
"@logux/client": "^0.8.4",
"@logux/client": "^0.8.5",
"@logux/core": "^0.5.3",

@@ -49,2 +49,7 @@ "nanoevents": "^5.1.7"

},
"./helpers/package.json": "./helpers/package.json",
"./helpers": {
"require": "./helpers/index.cjs",
"import": "./helpers/index.js"
},
"./mixin/package.json": "./mixin/package.json",

@@ -51,0 +56,0 @@ "./mixin": {

Sorry, the diff of this file is not supported yet

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