Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including vuex-observable-plugin with all npm packages installed. Try it out:

// Imports dependencies. const Vue = require('vue') const Vuex = require('vuex') const { VuexObservable, ofType } = require('vuex-observable-plugin') const { map } = require('rxjs/operators') // Defines a simple epic. const epics = [ (action$, store$, { ofType, map }) => { return action$.pipe( ofType('GENERATE_RANDOM_NUMBER'), map(() => ({ type: 'SET_NUMBER', payload: Math.random() })) ) } ] // Defines state. const state = { number: 0 } // Defines mutation. const mutations = { SET_NUMBER (state, number) { state.number = number } } // Initialises the store. Vue.use(Vuex) const store = new Vuex.Store({ state, mutations, plugins: [VuexObservable(epics, { dependencies: { ofType, map } })] }) // Dispatches an epic. store.dispatch('GENERATE_RANDOM_NUMBER') // Loggs the state after the epic has run. console.log(store.state.number)

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

vuex-observable-plugin v0.3.1

A plugin that adapts the popular redux-observable middleware to Vuex.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free