Slide 37
Slide 37 text
save: function(data, options) {
this.set(data, options);
if (!navigator.onLine) {
var transaction = db.transaction(this.name, 'readwrite');
var store = transaction.objectStore(this.name);
var insert = store.put(this.attributes);
insert.onsuccess = options.success;
!
var toSave = transaction.objectStore('to-save');
var tracker = toSave.put({id: this.id, name: this.name});
!
} else {
// write to server
}
}