JavaScript
{dialog.object}idbSetItem Method
Syntax
{dialog.object}.idbSetItem(key, value [, onSuccess [, onError]])
Arguments
- keystring
The key for the item in IndexedDB.
- valuebooleannumberstringdateobjectarrayregexpundefinednull
The value to store. Can be any JavaScript data type.
- onSuccessfunction
A JavaScript function to call if the operation succeeds. The onSuccess function is passed a parameter, data, which is the value of the item saved.
- onErrorfunction
A JavaScript function to call if the operation fails. The onError function is passed a parameter, err, which contains more information about the error.
Description
Saves a value to IndexedDB.
Discussion
The idbSetItem() method saves a value to IndexedDB. The value must be assigned a key. The key is used to retrieve the item later.
if ({dialog.object}.idbAvailable()) { var key = 'myKey'; var value = 'data for myKey'; var onSuccess = function (data) { alert('data was saved'); }; var onError = function (err) { alert('data was not saved'); }; {dialog.Object}.idbSetItem(key, value, onSuccess, onError); }
See Also