12.07.2015 Views

Pro JavaScript for Web Apps pdf - EBook Free Download

Pro JavaScript for Web Apps pdf - EBook Free Download

Pro JavaScript for Web Apps pdf - EBook Free Download

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 5 CREATING OFFLINE WEB APPS $()($)Total:$To start with, I have added a new observable data item to the view model, which represents the stateof the application cache:cache: {status: ko.observable(window.applicationCache.status)}I am using the view model because I want to disseminate the status into the HTML markup usingdata bindings. To keep the value up-to-date, I subscribe to a set of events triggered by thewindow.applicationCache object, like this:119www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!