xanf / vuex-shared-mutations Goto Github PK
View Code? Open in Web Editor NEWShare vuex mutations between tabs/windows
License: MIT License
Share vuex mutations between tabs/windows
License: MIT License
strateRy
OS: macOs 10.14.1
Bug reproduced in:
Not reproduced in:
I'm getting errors with last version of package (0.0.5).
vuex-shared-mutations.js:67 [vuex-shared-mutations] Unable to parse shared mutation data
vuex-shared-mutations.js:68 notification TypeError: Cannot read property 'type' of null at eval
Vuex如果引用了Module 模块的时候,我改如何使用
the docs say that the strategy will default to Broadcast Channel and downgrade to localStorage in case of necessity.
However the implementation does the opposite. it defaults to localStorage and switches to Broadcast Channel if localStorage isn't available
I ran the basic example on MAC safari and increment, decrement mutations are not getting shared.
Hey I was wondering how to use this with namespaced vuex modules. I have a few different modules.
I tried adding them to my predicates like they do in the demo example you have provided. For example:
'auth/login'
This doesn't seem to work. My application no longer recognizes this mutation.
When I try to create multiple instances of my store, the plugin work fine sharing the datas between it, but only when I commit a mutation all instances get updated.
If I don't commit a mutation the secondary storage instances still with default values instead take the states of first vuex instance.
Any way to sync states on init?
There seems to be a typo in 'LocalStorageStrategy' (LocalStorageStrateRy).
Tested using localStorage strategy.
When committing a mutation with a payload that contains a date object, the date is converted to a string in the receiving end.
This is probably due to the serialization of payload that's done before storing the payload in localStorage.
Please see details here along with a non vuex-shared-mutations workaround.
https://stackoverflow.com/questions/55818416/vue-sharing-websocket-data-across-browser-tabs/55834773#55834773
This may be due to the websocket never triggering the second browser tabs mutations. Relevant code is most likely this: https://github.com/nathantsoi/vue-native-websocket/blob/master/src/Observer.js#L83-L100
If there is something that can be done from vuex-shared-mutations, please let me know. If this falls outside of this packages responsibilities, please respond indicating that, and close the ticket.
Thank you for your plugin.
I using this plugin in Nuxt.js on production server.
But i got many logs.
[vuex-shared-mutations] localStorage is not available. Disabling plugin
[vuex-shared-mutations] localStorage is not available. Disabling plugin
[vuex-shared-mutations] localStorage is not available. Disabling plugin
Are you planning to implement logging off?
Is it possible to make all tabs to show logged in if user is logged in?
I'm using this.$auth.loginWith to login a user
Did I understood right? We can use this plugin and broadcast changes via Pusher.js?
I presume you can do something similar to [vuex-persistedstate#nuxtjs](https://github.com/robinvdvleuten/vuex-persistedstate#nuxtjs], but I haven't been able to pull it off.
Hi, do you thing this could work to share state between different BrowserWindows in an Electron application?
Thank you!
In your readme, in the "Hot it Works" section, says to use
..... new BroadcastStrategy({key:.....})........
if u do that the console shows:
Uncaught TypeError: vuex_shared_mutations__WEBPACK_IMPORTED_MODULE_2__.BroadcastStrategy is not a constructor
What u really must do is
..... new BroadcastChannelStrategy({key:.....})........
The Channel part is missing... at least that's how i made it work
I open two windows in Chrome, sell product in the first one. In the second mutation proceed, but state doesn't updated. Do you know why it can be happening?
Hello is it possible to perhaps use indexeddb using localForage instead of localstorage? I have a large set of data that im mutating. Are there any plans to provide this option?
Thank you
Kind regards
Please How can i used vuex-shared-mutations with nuxtjs
The "storage" event seems to be fired only when localStorage is changed (tested in Google Chrome 56), that is, not if the same change is made twice:
// In tab #1
window.addEventListener('storage', console.log)
// In tab #2
localStorage.x = 'a'
localStorage.x = 'b'
localStorage.x = 'a'
localStorage.x = 'a'
// In tab #1
// console.log only fired 3 times, not 4
Because this plugin doesn't reset the the value between setting mutation, the counter example (after adding this plugin) wouldn't sync as expected (the same "increment" mutation would be committed multiple times, but only the first one is shared).
To fix this, reset the value after setting it (window.localStorage.removeItem(key);
in store.subscribe
) and abort in the event listener (if (event.newValue === null) return;
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.