kolite

How to load koLite with requirejs?

南楼画角 提交于 2020-01-17 10:57:50
问题 This is from knockout.dirtyFlag.js ;(function (ko) { ko.DirtyFlag = function (objectToTrack, isInitiallyDirty, hashFunction) { hashFunction = hashFunction || ko.toJSON; var _objectToTrack = objectToTrack, _lastCleanState = ko.observable(hashFunction(_objectToTrack)), _isInitiallyDirty = ko.observable(isInitiallyDirty), result = function () { var self = this; self.isDirty = ko.computed(function () { return _isInitiallyDirty() || hashFunction(_objectToTrack) !== _lastCleanState(); }); self

How to load koLite with requirejs?

假装没事ソ 提交于 2020-01-17 10:55:26
问题 This is from knockout.dirtyFlag.js ;(function (ko) { ko.DirtyFlag = function (objectToTrack, isInitiallyDirty, hashFunction) { hashFunction = hashFunction || ko.toJSON; var _objectToTrack = objectToTrack, _lastCleanState = ko.observable(hashFunction(_objectToTrack)), _isInitiallyDirty = ko.observable(isInitiallyDirty), result = function () { var self = this; self.isDirty = ko.computed(function () { return _isInitiallyDirty() || hashFunction(_objectToTrack) !== _lastCleanState(); }); self

Knockoutjs track changes after ajax call

孤街醉人 提交于 2020-01-07 01:52:33
问题 See JsFiddle here http://jsfiddle.net/WtgbV/2/ In words: I have some ajax call, and in the server's response I get some array of items (Items in knockout viewmodel) I need to know that property name was changed in element with id==2 etc to save changes automatically on server (via POST request) What is the simplest/easiest way to track changes in each element in Items array? 回答1: I co-wrote a component called DirtyFlag that detects changes in Knockout observables (or a set of them). You can