lajosbencz / vue-wamp

AutobahnJS wrapper library fo Vue.js
MIT License
48 stars 13 forks source link

Vuex support #1

Open Yamakaky opened 7 years ago

Yamakaky commented 7 years ago

Cool lib! Do you support vuex?

lajosbencz commented 7 years ago

Hello, thanks! I'm using vuex, but only to make the isConnected, isOpen and isRetrying properties global and reactive.

What feature do you have in mind?

Yamakaky commented 7 years ago

Well, my whole state is synced! Currently I do that for getting the state:

    function playlist_next_ids(playlist_ids) {
        store.commit(Mut.set_playlist_next_ids.name, playlist_ids)
    }
    session.subscribe(Sub.playlist_next_ids.name, playlist_next_ids)

and that in the actions:

        delete_media({ commit }, media) {
            commit(Mut.delete_media_id.name, media.id)
            publish(Sub.delete_media_ids, [media.id])
        },

publish being a session.public using the wamp session as global variable. It's not a lot of code and it's only in one place so maybe it's not necessary to use vue-wamp.