{"action":"created","issue":{"url":"https://api.github.com/repos/Areson/Knockout-Extensions/issues/3","labels_url":"https://api.github.com/repos/Areson/Knockout-Extensions/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/Areson/Knockout-Extensions/issues/3/comments","events_url":"https://api.github.com/repos/Areson/Knockout-Extensions/issues/3/events","html_url":"https://github.com/Areson/Knockout-Extensions/pull/3","id":21275607,"number":3,"title":"Update knockout.dirtiable.js","user":{"login":"nenitiko","id":869666,"avatar_url":"https://avatars.githubusercontent.com/u/869666?v=3","gravatar_id":"","url":"https://api.github.com/users/nenitiko","html_url":"https://github.com/nenitiko","followers_url":"https://api.github.com/users/nenitiko/followers","following_url":"https://api.github.com/users/nenitiko/following{/other_user}","gists_url":"https://api.github.com/users/nenitiko/gists{/gist_id}","starred_url":"https://api.github.com/users/nenitiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nenitiko/subscriptions","organizations_url":"https://api.github.com/users/nenitiko/orgs","repos_url":"https://api.github.com/users/nenitiko/repos","events_url":"https://api.github.com/users/nenitiko/events{/privacy}","received_events_url":"https://api.github.com/users/nenitiko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-10-20T07:39:40Z","updated_at":"2015-02-11T20:09:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Areson/Knockout-Extensions/pulls/3","html_url":"https://github.com/Areson/Knockout-Extensions/pull/3","diff_url":"https://github.com/Areson/Knockout-Extensions/pull/3.diff","patch_url":"https://github.com/Areson/Knockout-Extensions/pull/3.patch"},"body":"This is actually a mixed-up version of Ryan's and your work. From Ryan's implementation I took the dirty-able functionality from you I took the interface, the extender and the initiative. One of the problems I found with your implementation was that once an object was made dirty there was no turning back, it stayed dirty even when changing all properties to their initial values, for example if you track an Array and add an item, it is marked was dirty but if you removed that same item, it wont go back to non-dirty state. Ryan's work supports that."},"comment":{"url":"https://api.github.com/repos/Areson/Knockout-Extensions/issues/comments/73954798","html_url":"https://github.com/Areson/Knockout-Extensions/pull/3#issuecomment-73954798","issue_url":"https://api.github.com/repos/Areson/Knockout-Extensions/issues/3","id":73954798,"user":{"login":"Areson","id":1489856,"avatar_url":"https://avatars.githubusercontent.com/u/1489856?v=3","gravatar_id":"","url":"https://api.github.com/users/Areson","html_url":"https://github.com/Areson","followers_url":"https://api.github.com/users/Areson/followers","following_url":"https://api.github.com/users/Areson/following{/other_user}","gists_url":"https://api.github.com/users/Areson/gists{/gist_id}","starred_url":"https://api.github.com/users/Areson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Areson/subscriptions","organizations_url":"https://api.github.com/users/Areson/orgs","repos_url":"https://api.github.com/users/Areson/repos","events_url":"https://api.github.com/users/Areson/events{/privacy}","received_events_url":"https://api.github.com/users/Areson/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T20:09:03Z","updated_at":"2015-02-11T20:09:03Z","body":"Ack! It's been a while since I looked over this. You are correct about it not \"turning back\", but one thing I didn't like was the fact that we had to always parse out the object to JSON every time a change was made to it, as this was potentially rather expensive. As a compromise, I simply said that once it was dirty, it stayed dirty. This allows us to skip re-creating the JSON, which would be necessary if we wanted the object to pop back to clean if it reverted to its initial state.\r\n\r\nWith the changes you've proposed, you actually don't need the \"_isInitiallyDirty\" value, as it isn't set to anything other than \"false\", and simply have the extension rely on looking at the JSON.\r\n\r\nI think an ideal setup would be to have a second argument for the extension that let's you toggle between a \"deep\" dirty tracking (which would revert back to clean if we went back to the initial state) or a \"simple\" dirty tracking which would not revert. This would give you flexibility based on your performance and application needs."}}