Skip to content
This repository has been archived by the owner. It is now read-only.
Consume Vuex actions as Observables using RxJS 5
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example return observable from actions Nov 29, 2016
src import rxjs/Subject instead since rxjs/subject is broken (#1) Jul 5, 2017
test init Nov 29, 2016
.babelrc init Nov 29, 2016
.gitignore init Nov 29, 2016
LICENSE init Nov 29, 2016
README.md Update README.md Dec 25, 2018
package.json init Nov 29, 2016

README.md

THIS REPOSITORY IS DEPRECATED

vuex-observable

Proof of Concept, DO NOT USE YET

Consume Vuex actions as Observables using RxJS 5, inspired by redux-observable.

Usage

import Vue from 'vue'
import Vuex from 'vuex'
import { observableAction } from 'vuex-observable'
import 'rxjs/add/operator/delay'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    pinging: false
  },
  mutations: {
    ping: state => state.pinging = true,
    pong: state => state.pinging = false
  },
  actions: {
    ping: observableAction((action$, { commit }) => {
      action$.subscribe(() => commit('ping'))
      action$.delay(1000).subscribe(() => commit('pong'))
    })
  }
})

TODOs

  • Working with multiple actions as source
  • Adaptors
  • Cancellation
  • HMR support
You can’t perform that action at this time.