0.1.3 • Published 5 years ago

vuex-watcher v0.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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}`)
    }
  ]
}