Skip to content

A Vuex state watcher to empower Vue.js developers to easily utilize Vuex subscribers similar to vue's data prop watcher

License

Notifications You must be signed in to change notification settings

AndrewR3K/vuex-watcher

Repository files navigation


logo of vue-watcher repository

Vuex-Watcher

 Release Number License: MIT

Vue-Watcher was created to empower Vue.js developers to easily utilize Vuex subscribers similalr to vue's data prop watcher

This is compatible with Vue 2.*

This is an Alpha build, use at your own risk

Table of Contents

NPM Install

npm install vuex-watcher

Local Clone

$ git clone https://github.com/AndrewR3K/vuex-watcher.git vuex-watcher

$ cd vuex-watcher
$ npm install

Development

$ npm install

$ npm run dev

Usage

An in-depth example application can be found within /example folder of this repo.

General Usage

import VueWatcher from 'vuex-watcher';
const myVueWatcher = new VueWatcher({
  environment: 'development',
  watches: [
    {
      getter: 'getactive',
      cb: (val) => console.log(`Running getters' "getMsg" callback => ${val}`)
    }
  ]
})

export default new Vuex.Store({
  plugins: [myVueWatcher]
})

Environment

It is recommended to set the environment to "production" when running in a production state.

Options: 'development', 'production'

{
  environment: <environment>
}

Watcher Types

State

{
  watches: [
    {
      state: 'text',
      cb: (val) => console.log(`Running state "text" callback => ${val}`)
    }
  ]
}

Getters

{
  watches: [
    {
      getter: 'getactive',
      cb: (val) => console.log(`Running getters "getMsg" callback => ${val}`)
    }
  ]
}

About

A Vuex state watcher to empower Vue.js developers to easily utilize Vuex subscribers similar to vue's data prop watcher

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published