Table of Contents

Class IDBFactory

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The IDBFactory interface of the IndexedDB API lets applications asynchronously access the indexed databases. The object that implements the interface is window.indexedDB. You open — that is, create and access — and delete a database with this object, and not directly with IDBFactory.

[Value("IDBFactory")]
public class IDBFactory
Inheritance
IDBFactory
Inherited Members

Remarks

-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).

See also on MDN

Constructors

IDBFactory()

public IDBFactory()

Methods

Cmp(dynamic, dynamic)

The cmp() method of the IDBFactory
interface compares two values as keys to determine equality and ordering for IndexedDB
operations, such as storing and iterating.

[Value("cmp")]
public Number Cmp(dynamic first, dynamic second)

Parameters

first dynamic
second dynamic

Returns

Number

An integer that indicates the result of the comparison; the table below lists the
possible values and their meanings:

Returned valueDescription
-11st key is less than the 2nd key
01st key is equal to the 2nd key
11st key is greater than the 2nd key

Remarks

NOTE

Do not use this method for comparing arbitrary JavaScript
values, because many JavaScript values are either not valid IndexedDB keys (booleans
and objects, for example) or are treated as equivalent IndexedDB keys (for example,
since IndexedDB ignores arrays with non-numeric properties and treats them as empty
arrays, so any non-numeric arrays are treated as equivalent). This throws an exception
if either of the values is not a valid key.

-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).

See also on MDN

Databases()

The databases method of the IDBFactory interface returns a {{jsxref("Promise")}} that fulfills with an array of objects containing the name and version of all the available databases.

[Value("databases")]
public Task<List<IDBDatabaseInfo>> Databases()

Returns

Task<List<IDBDatabaseInfo>>

A Promise that fulfills with an array of objects representing a snapshot of the available databases (or rejects with the error/exceptions below).Each array object has the following properties:Note that the sequence on the returned objects is undefined.

Remarks

This is a snapshot of the databases, intended primarily to allow web applications to check what databases have been created — in order to, for example, clean up databases created by earlier versions of application code.

-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).

See also on MDN

DeleteDatabase(string)

The deleteDatabase() method of the
IDBFactory interface requests the deletion of a database. The method
returns an IDBOpenDBRequest object immediately, and performs the deletion
operation asynchronously.

[Value("deleteDatabase")]
public IDBOpenDBRequest DeleteDatabase(string name)

Parameters

name string

Returns

IDBOpenDBRequest

A IDBOpenDBRequest on which subsequent events related to this request are fired.If the operation is successful, the value of the request's Result property is null.

Remarks

If the database is successfully deleted, then a success event is fired on
the request object returned from this method, with its result set to
undefined. If an error occurs while the database is being deleted, then an
error event is fired on the request object that is returned from this
method.

When deleteDatabase() is called, any other open connections to this
particular database will get a versionchange event.

-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).

See also on MDN

Open(string, ulong)

The open() method of the IDBFactory interface requests opening a connection to a database.

[Value("open")]
public IDBOpenDBRequest Open(string name, ulong version = 0)

Parameters

name string
version ulong

Returns

IDBOpenDBRequest

A IDBOpenDBRequest object on which subsequent events related to this request are fired.If the operation is successful, the value of the request's Result property is a IDBDatabase object representing the connection to the database.

Remarks

The method returns an IDBOpenDBRequest object immediately, and performs the open operation asynchronously.
If the operation is successful, a success event is fired on the request object that is returned from this method, with its result attribute set to the new IDBDatabase object for the connection.

May trigger upgradeneeded, blocked or versionchange events.

-Using IndexedDB
-Browser storage quotas and eviction criteria.
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).

See also on MDN