Skip to content

Commit

Permalink
Added forceDirty method to knockout.dirtyFlag.js
Browse files Browse the repository at this point in the history
Allows using code to force a dirtyFlag into the dirty state after it has been initialized created.
  • Loading branch information
Jeremy Cook committed Jan 7, 2013
1 parent 6105bb4 commit 77899e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion knockout.dirtyFlag.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
result = function () {
var self = this;

self.forceDirty = function ()
{
_isInitiallyDirty(true);
};

self.isDirty = ko.computed(function () {
return _isInitiallyDirty() || hashFunction(_objectToTrack) !== _lastCleanState();
});
Expand All @@ -56,4 +61,4 @@

return result;
};
})(ko);
})(ko);

0 comments on commit 77899e3

Please sign in to comment.