add method
The add()
method of the IDBObjectStore interface returns 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.
To determine if the add operation has completed successfully, listen for
the
transaction's complete
event in addition to the
IDBObjectStore.add
request's success
event, because the
transaction may still fail after the success event fires. In other words,
the success
event is only triggered when the transaction has been successfully queued.
The add method is an insert only method. If a
record already exists in the object store with the key
parameter as its
key, then an error ConstraintError
event is fired on the returned
request
object. For updating existing records, you should use the
IDBObjectStore.put method instead.
Implementation
external IDBRequest add(
JSAny? value, [
JSAny? key,
]);