Commit 705154dc authored by Sindre Sorhus's avatar Sindre Sorhus

Knockout app - code style

parent c14b3976
...@@ -151,20 +151,20 @@ ...@@ -151,20 +151,20 @@
// internal computed observable that fires whenever anything changes in our todos // internal computed observable that fires whenever anything changes in our todos
ko.computed(function () { ko.computed(function () {
// store a clean copy to local storage, which also creates a dependency on the observableArray and all observables in each item // store a clean copy to local storage, which also creates a dependency on the observableArray and all observables in each item
localStorage.setItem('todos-knockout', ko.toJSON(self.todos)); localStorage.setItem('todos-knockoutjs', ko.toJSON(self.todos));
}).extend({ }).extend({
throttle: 500 throttle: 500
}); // save at most twice per second }); // save at most twice per second
}; };
// check local storage for todos // check local storage for todos
var todos = ko.utils.parseJson(localStorage.getItem('todos-knockout')); var todos = ko.utils.parseJson(localStorage.getItem('todos-knockoutjs'));
// bind a new instance of our view model to the page // bind a new instance of our view model to the page
var viewModel = new ViewModel(todos || []); var viewModel = new ViewModel(todos || []);
ko.applyBindings(viewModel); ko.applyBindings(viewModel);
// set up filter routing // set up filter routing
/*jshint newcap:false*/ /*jshint newcap:false */
Router({'/:filter': viewModel.showMode}).init(); Router({'/:filter': viewModel.showMode}).init();
}()); })();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment