@mmckegg/mutant
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -180,3 +180,7 @@ /* A lazy binding take on computed */ | ||
this.lazy = false | ||
this.update() | ||
if (this.opts && this.opts.nextTick && this.live && this.lazy) { | ||
this.onUpdate() // use cached value to make more responsive | ||
} else { | ||
this.update() | ||
} | ||
if (this.inner) { | ||
@@ -183,0 +187,0 @@ this.outputValue = resolve(this.inner) |
module.exports = function (update, onBind, onUnbind) { | ||
var lazy = false | ||
var context = this | ||
@@ -21,3 +22,3 @@ var obj = { | ||
onUpdate: function () { | ||
if (update()) { | ||
if (update.apply(context)) { | ||
broadcast() | ||
@@ -30,3 +31,3 @@ } | ||
lazy = false | ||
update() | ||
update.apply(context) | ||
} | ||
@@ -36,3 +37,3 @@ }, | ||
getValue: function () { | ||
obj.checkUpdated() | ||
obj.checkUpdated.apply(context) | ||
return obj.value | ||
@@ -51,3 +52,3 @@ }, | ||
lazy = true | ||
onBind() | ||
onBind.apply(context) | ||
} | ||
@@ -64,3 +65,3 @@ | ||
obj.live = false | ||
onUnbind() | ||
onUnbind.apply(context) | ||
} | ||
@@ -67,0 +68,0 @@ } |
{ | ||
"name": "@mmckegg/mutant", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "array.js", |
module.exports = watch | ||
function watch (observable, listener) { | ||
listener = listener || noop | ||
if (typeof observable === 'function') { | ||
@@ -5,0 +6,0 @@ var remove = observable(listener) |
67071
2400