vue-model-x
Advanced tools
Comparing version 0.5.3 to 0.6.0
@@ -20,2 +20,6 @@ import { Watcher } from './vue-internals'; | ||
_proto.watch = function watch(expression, callback, options) { | ||
if (options === void 0) { | ||
options = {}; | ||
} | ||
if (!this.hasOwnProperty('_watchers')) { | ||
@@ -34,5 +38,7 @@ defineWatchersProperty(this); | ||
options.lazy = false; | ||
options.user = false; | ||
var watcher = new Watcher(this, expression, callback, options); | ||
if (options && options.immediate) { | ||
if (options.immediate) { | ||
callback.call(this, watcher.value); | ||
@@ -39,0 +45,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { Store } from './Store'; | ||
export var storeMeta = Symbol('VueModelXStoreMeta'); | ||
@@ -14,2 +15,6 @@ export function store(meta) { | ||
if (!(cls.prototype instanceof Store)) { | ||
throw new TypeError("VueModelX: \"" + cls.name + "\" class must extend \"Store\" class"); | ||
} | ||
Object.defineProperty(cls, storeMeta, { | ||
@@ -16,0 +21,0 @@ value: meta, |
@@ -27,2 +27,6 @@ "use strict"; | ||
_proto.watch = function watch(expression, callback, options) { | ||
if (options === void 0) { | ||
options = {}; | ||
} | ||
if (!this.hasOwnProperty('_watchers')) { | ||
@@ -41,5 +45,7 @@ (0, _utils.defineWatchersProperty)(this); | ||
options.lazy = false; | ||
options.user = false; | ||
var watcher = new _vueInternals.Watcher(this, expression, callback, options); | ||
if (options && options.immediate) { | ||
if (options.immediate) { | ||
callback.call(this, watcher.value); | ||
@@ -46,0 +52,0 @@ } |
@@ -6,2 +6,5 @@ "use strict"; | ||
exports.storeMeta = void 0; | ||
var _Store = require("./Store"); | ||
var storeMeta = Symbol('VueModelXStoreMeta'); | ||
@@ -22,2 +25,6 @@ exports.storeMeta = storeMeta; | ||
if (!(cls.prototype instanceof _Store.Store)) { | ||
throw new TypeError("VueModelX: \"" + cls.name + "\" class must extend \"Store\" class"); | ||
} | ||
Object.defineProperty(cls, storeMeta, { | ||
@@ -24,0 +31,0 @@ value: meta, |
{ | ||
"name": "vue-model-x", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"description": "MobX-like state management library for Vue.js", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -17,3 +17,3 @@ import {Watcher} from './vue-internals'; | ||
watch(expression, callback, options) { | ||
watch(expression, callback, options = {}) { | ||
if (!this.hasOwnProperty('_watchers')) { | ||
@@ -33,5 +33,8 @@ defineWatchersProperty(this); | ||
options.lazy = false; | ||
options.user = false; | ||
const watcher = new Watcher(this, expression, callback, options); | ||
if (options && options.immediate) { | ||
if (options.immediate) { | ||
callback.call(this, watcher.value); | ||
@@ -38,0 +41,0 @@ } |
@@ -0,1 +1,3 @@ | ||
import {Store} from './Store'; | ||
export const storeMeta = Symbol('VueModelXStoreMeta'); | ||
@@ -16,2 +18,6 @@ | ||
if (!(cls.prototype instanceof Store)) { | ||
throw new TypeError(`VueModelX: "${cls.name}" class must extend "Store" class`); | ||
} | ||
Object.defineProperty(cls, storeMeta, { | ||
@@ -18,0 +24,0 @@ value: meta, |
28495
812