vaf
promise flux library for vue and react
install
npm i --save-dev vaf
Vue useage
Vue // install pluginlet flux =strict: true // enable this for promise action to resolve data copyfluxdeclare... // declare you moduleslet app =vaf: flux // installcomputed: // map getters like vuexmethods: // map actions like vuex
declare modules
fluxdeclare state: todoList: mutations: { todoList return todoList // return updateState object if nessesary } actions: { let newItem = {} newItemtitle = title newItemid = ++ _startIdx newItemisCompleted = false return // return promise if nessesary }
Flux api
// for actions fluxdeclare actions: // can replace dispatch("doSomeAction", payload) below if has Proxy return dispatch // inject plugins flux // events flux flux flux // state flux flux // return state copy flux