HTML and CSS Reference
In-Depth Information
Table B.26 lists some of the methods for creating indexes and working with the object
store. These methods belong to the IDBObjectStore object.
Table B.26. IDBObjectStore interface
Attribute/method
Description
Creates and returns a new IDBIndex object with given name and keypath. This method
can only be called from a VersionChange transaction mode callback. The optional para-
meters object has the following properties:
createIndex(name, keypath,
[parameters])
• unique
If true, the index won't allow duplicate values for a single key.
If true, when the keypath resolves to an Array, the index will add an entry in the index for
each array element. If false, the index will add one single entry containing the Array.
• multiEntry
index(name)
Returns the name index in the object store.
Immediately returns an IDBRequest object, then, on a separate thread, creates a cursor
over the records in the object store. The range parameter specifies the key range of the
cursor. If the range is not specified, it defaults to all records in the object store. The direc-
tion parameter defines the cursor's direction of movement.
openCursor([range], [direc-
tion])
Immediately returns an IDBRequest object, then, on a separate thread, creates a clone of
the value and stores it in the object store. The value parameter defines the value to be
stored. The parameter key identifies the record. If not defined, it defaults to null.
put(value, [key])
Table B.27 lists the onupgradeneeded event handler used in the My Tasks application.
onupgradeneeded is an event in the IDBOpenDBRequest interface that provides ac-
cess to results of requests to open a database using event handler attributes.
Table B.27. IDBOpenDBRequest interface
Attribute/method
Description
The event handler attribute for the upgrade needed event. This event handler is executed
when a database's version number has increased.
onupgradeneeded
Table B.28 lists the onsuccess event handler used in the My Tasks application to access
the results of an asynchronous request. onsuccess is an event in the IDB-Request in-
terface that provides access to results of asynchronous requests to databases and database
objects using event handler attributes. Reading and writing operations on a database are
executed with a request.
 
 
Search WWH ::




Custom Search