put method
The put()
method of the IDBObjectStore interface updates a given
record in a database, or inserts a new record if the given item does not
already exist.
It 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, or updating existing records in an object store when
the transaction's mode is readwrite
. If the record is successfully
stored, then a success event is fired on the returned request object with
the result
set to the key for the stored record, and the transaction
set to the transaction in which this object store is opened.
The put method is an update or insert method. See the IDBObjectStore.add method for an insert only method.
Bear in mind that if you have a IDBCursor to the record you want to update, updating it with IDBCursor.update is preferable to using IDBObjectStore.put. Doing so makes it clear that an existing record will be updated, instead of a new record being inserted.
Implementation
external IDBRequest put(
JSAny? value, [
JSAny? key,
]);