forked from rescript-lang/experimental-rescript-webapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIDBDatabase.res
More file actions
58 lines (50 loc) · 1.82 KB
/
IDBDatabase.res
File metadata and controls
58 lines (50 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
open IndexedDBAPI
include EventTarget.Impl({
type t = idbDatabase
})
/**
Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction)
*/
@send
external transaction: (
idbDatabase,
~storeNames: string,
~mode: idbTransactionMode=?,
~options: idbTransactionOptions=?,
) => idbTransaction = "transaction"
/**
Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction)
*/
@send
external transaction2: (
idbDatabase,
~storeNames: array<string>,
~mode: idbTransactionMode=?,
~options: idbTransactionOptions=?,
) => idbTransaction = "transaction"
/**
Closes the connection once all running transactions have finished.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/close)
*/
@send
external close: idbDatabase => unit = "close"
/**
Creates a new object store with the given name and options and returns a new IDBObjectStore.
Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/createObjectStore)
*/
@send
external createObjectStore: (
idbDatabase,
~name: string,
~options: idbObjectStoreParameters=?,
) => idbObjectStore = "createObjectStore"
/**
Deletes the object store with the given name.
Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/deleteObjectStore)
*/
@send
external deleteObjectStore: (idbDatabase, string) => unit = "deleteObjectStore"