package js.html.idb
Available on js
This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.)
Documentation IDBObjectStore by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
read onlyautoIncrement:BoolThe value of the auto increment flag for this object store.
read onlyindexNames:DOMStringListA list of the names of indexes on objects in this object store.
read onlykeyPath:DynamicThe key path of this object store. If this attribute is null, the application must provide a key for each modification operation.
name:StringThe name of this object store.
read onlytransaction:TransactionThe IDBTransaction object to which this object store belongs.
add(value:Dynamic, ?key:Dynamic):RequestReturns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for adding new records to an object store.
Throws:
null |
DOMError |
|---|
clear():RequestCreates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all current records out of an object store.
Throws:
null |
DOMError |
|---|
count(?key:Dynamic):RequestReturns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange. If no arguments are provided, it returns the total number of records in the store.
Throws:
null |
DOMError |
|---|
createIndex(name:String, keyPath:String, ?optionalParameters:Null<IndexParameters>):IndexcreateIndex(name:String, keyPath:Array<String>, ?optionalParameters:Null<IndexParameters>):IndexCreates a new index during a version upgrade, returning a new IDBIndex object in the connected database.
Throws:
null |
DOMError |
|---|
delete(key:Dynamic):Requestreturns an IDBRequest object, and, in a separate thread, deletes the store object selected by the specified key. This is for deleting individual records out of an object store.
Throws:
null |
DOMError |
|---|
deleteIndex(indexName:String):VoidDestroys the specified index in the connected database, used during a version upgrade.
Throws:
null |
DOMError |
|---|
get(key:Dynamic):RequestReturns an IDBRequest object, and, in a separate thread, returns the store object store selected by the specified key. This is for retrieving specific records from an object store.
Throws:
null |
DOMError |
|---|
getAll(?key:Dynamic, ?limit:Int):RequestReturns an IDBRequest object retrieves all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
Throws:
null |
DOMError |
|---|
getAllKeys(?key:Dynamic, ?limit:Int):RequestReturns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
Throws:
null |
DOMError |
|---|
getKey(key:Dynamic):RequestReturns an IDBRequest object, and, in a separate thread retrieves and returns the record key for the object in the object stored matching the specified parameter.
Throws:
null |
DOMError |
|---|
index(name:String):IndexOpens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor.
Throws:
null |
DOMError |
|---|
openCursor(?range:Dynamic, direction:CursorDirection = NEXT):RequestReturns an IDBRequest object, and, in a separate thread, returns a new IDBCursorWithValue object. Used for iterating through an object store by primary key with a cursor.
Throws:
null |
DOMError |
|---|
openKeyCursor(?range:Dynamic, direction:CursorDirection = NEXT):RequestReturns an IDBRequest object, and, in a separate thread, returns a new IDBCursor. Used for iterating through an object store with a key.
Throws:
null |
DOMError |
|---|
put(value:Dynamic, ?key:Dynamic):RequestReturns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for updating existing records in an object store when the transaction's mode is readwrite.
Throws:
null |
DOMError |
|---|
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/idb/ObjectStore.html