Skip to content

Commit

Permalink
computed is "active" if it might be evaluated in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
mbest committed Sep 6, 2012
1 parent f775578 commit ce18b1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/subscribables/dependentObservable.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,16 @@ ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunction
return _latestValue;
}

function isActive() {
return !_hasBeenEvaluated || _subscriptionsToDependencies.length > 0;
}

// By here, "options" is always non-null
var writeFunction = options["write"],
disposeWhenNodeIsRemoved = options["disposeWhenNodeIsRemoved"] || options.disposeWhenNodeIsRemoved || null,
disposeWhen = options["disposeWhen"] || options.disposeWhen || function() { return false; },
dispose = disposeAllSubscriptionsToDependencies,
_subscriptionsToDependencies = [],
isActive = function() { return _subscriptionsToDependencies.length > 0; },
evaluationTimeoutInstance = null;

if (!evaluatorFunctionTarget)
Expand Down

0 comments on commit ce18b1c

Please sign in to comment.