HTML and CSS Reference
In-Depth Information
errorCallback('storage_api_not_initialized', 'The storage engine has not been initialized');
}
var result = [];
var tx = database.transaction(type);
var objectStore = tx.objectStore(type);
objectStore.openCursor().onsuccess = function(event) {
var cursor = event.target.result;
if (cursor) {
if (cursor.value[propertyName] == propertyValue) {
result.push(cursor.value);
}
cursor.continue();
} else {
successCallback(result);
}
};
},
findById : function (type, id, successCallback, errorCallback) {
if (!database) {
errorCallback('storage_api_not_initialized', 'The storage engine has not been initialized');
}
var tx = database.transaction([type]);
var objectStore = tx.objectStore(type);
var request = objectStore.get(id);
request.onsuccess = function(event) {
successCallback(event.target.result);
}
request.onerror = function(event) {
errorCallback('object_not_stored', 'It is not possible to locate the requested object');
};
}
}
}();
Search WWH ::




Custom Search