February 2015
Intermediate to advanced
232 pages
4h 40m
English
We have just one view-model in our application. This is a component where we can apply the singleton module approach.
We are going to carefully create our first module step by step:
viewmodel.js file.Shop module, which is the top module of our application:var Shop;
Shop module by applying the extension pattern:Shop = Shop || {};ViewModel component:Shop.ViewModel = (function(){})();Shop.ViewModel = (function(){ var debug = ko.observable(false); var showDebug = function () { debug(true); }; var hideDebug = function () { debug(false); }; var visibleCatalog = ko.observable(true); // ... the rest of the code return ...Read now
Unlock full access