Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@logux/vuex
Advanced tools
Logux is a new way to connect client and server. Instead of sending HTTP requests (e.g., AJAX and GraphQL) it synchronizes log of operations between client, server, and other clients.
This repository contains Vuex compatible API on top of the Logux Client.
The current version is for Vue 3 and Vuex 4. For Vue 2 support, we have 0.8 version from a separate branch.
npm install @logux/vuex vuex
or
yarn add @logux/vuex vuex
See documentation for Logux API.
import { CrossTabClient, createStoreCreator } from '@logux/vuex'
const client = new CrossTabClient({
server: process.env.NODE_ENV === 'development'
? 'ws://localhost:31337'
: 'wss://logux.example.com',
subprotocol: '1.0.0',
userId: 'anonymous',
token: ''
})
const createStore = createStoreCreator(client)
const store = createStore({
state: {},
mutations: {},
actions: {},
modules: {}
})
store.client.start()
export default store
useSubscription
Composable function that subscribes for channels during component initialization and unsubscribes on unmount.
<template>
<h1 v-if="isSubscribing">Loading</h1>
<h1 v-else>{{ user.name }}</h1>
</template>
<script>
import { toRefs } from 'vue'
import { useStore, useSubscription } from '@logux/vuex'
export default {
props: {
userId: String
},
setup (props) {
let store = useStore()
let { userId } = toRefs(props)
let isSubscribing = useSubscription(() => [`user/${userId}`])
let user = computed(() => store.state.users[userId])
return {
user,
isSubscribing
}
}
})
</script>
Subscribe
Component-wrapper that subscribes for channels during component initialization and unsubscribes on unmount.
<template>
<subscribe :channels="channels" v-slot="{ isSubscribing }">
<h1 v-if="isSubscribing">Loading</h1>
<h1 v-else>{{ user.name }}</h1>
</subscribe>
</template>
<script>
import { toRefs, computed } from 'vue'
import { Subscribe, useStore } from '@logux/vuex'
export default {
components: {
Subscribe
},
props: {
userId: String
},
setup (props) {
let store = useStore()
let { userId } = toRefs(props)
let user = computed(() => store.state.users[userId])
let channels = computed(() => [`users/${userId}`])
return {
user,
channels
}
}
}
</script>
Place the following code in your project to allow this.$store to be typed correctly:
// shims-vuex.d.ts
import { LoguxVuexStore } from '@logux/vuex'
declare module '@vue/runtime-core' {
// Declare your own store states.
interface State {
count: number
}
interface ComponentCustomProperties {
$store: LoguxVuexStore<State>
}
}
0.9.2
useSubscription
’s argument channels
can be a getter functionFAQs
Vuex compatible API for Logux
The npm package @logux/vuex receives a total of 54 weekly downloads. As such, @logux/vuex popularity was classified as not popular.
We found that @logux/vuex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.