forked from fable-compiler/fable-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrowser.IndexedDB.fs
More file actions
188 lines (150 loc) · 6.65 KB
/
Browser.IndexedDB.fs
File metadata and controls
188 lines (150 loc) · 6.65 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
namespace rec Browser.Types
open Fable.Core
[<Erase>]
type IDBRequestSource =
| Index of IDBIndex
| ObjectStore of IDBObjectStore
| Cursor of IDBCursor
[<StringEnum>]
type IDBRequestReadyState =
| Pending
| Done
[<StringEnum>]
type IDBTransactionMode =
| Readonly
| Readwrite
| Versionchange
[<StringEnum>]
type IDBTransactionDuarability =
| Strict
| Relaxed
| Default
[<StringEnum>]
type IDBCursorDirection =
| Next
| Nextunique
| Prev
| Prevunique
type [<AllowNullLiteral>] DatabasesType =
abstract name: string
abstract version: int64
type [<Global;AllowNullLiteral>] IDBIndex =
abstract isAutoLocale: bool with get
abstract locale: string with get
abstract name: string with get
abstract objectStore: IDBObjectStore with get
abstract keyPath: obj with get
abstract multiEntry: bool with get
abstract unique: bool with get
abstract count: ?key: obj -> IDBRequest
abstract get: ?key: obj -> IDBRequest
abstract getKey: ?key: obj -> IDBRequest
abstract getAll: ?query: obj * ?count: int -> IDBRequest
abstract getAllKeys: ?query: obj * ?count: int -> IDBRequest
abstract openCursor: ?range: obj * ?direction: IDBCursorDirection -> IDBRequest
abstract openKeyCursor: ?range: obj * ?direction: IDBCursorDirection -> IDBRequest
type [<Global;AllowNullLiteral>] IDBVersionChangeEvent =
inherit Event
abstract oldVersion: int64 with get
abstract newVersion: int64 with get
type [<Global>] [<AbstractClass; AllowNullLiteral>] IDBKeyRange =
abstract lower: obj with get
abstract upper: obj with get
abstract lowerOpen: bool with get
abstract upperOpen: bool with get
abstract includes: obj -> bool
[<Emit("IDBKeyRange.bound($0, $1, $2, $3)")>]
static member bound(lower: obj, upper: obj, ?lowerOpen: bool, ?upperOpen: bool) = jsNative<IDBKeyRange>
[<Emit("IDBKeyRange.only($0)")>]
static member only(only: obj) = jsNative<IDBKeyRange>
[<Emit("IDBKeyRange.lowerBound($0, $1)")>]
static member lowerBound(lower: obj, ?``open``: bool) = jsNative<IDBKeyRange>
[<Emit("IDBKeyRange.upperBound($0, $1)")>]
static member upperBound(upper: obj, ?``open``: bool) = jsNative<IDBKeyRange>
type [<Global;AllowNullLiteral>] IDBCursor =
abstract source: IDBObjectStore with get
abstract direction: IDBCursorDirection with get
abstract key: obj option with get
abstract primaryKey: obj option with get
abstract request: IDBRequest with get
abstract advance: count: int -> unit
abstract ``continue``: ?key: obj -> unit
abstract continuePrimaryKey: key: obj * primaryKey: obj -> unit
abstract delete: unit -> IDBRequest
abstract update: value: obj -> IDBRequest
type [<Global;AllowNullLiteral>] IDBCursorWithValue =
inherit IDBCursor
abstract value: obj option with get
type [<Global;AllowNullLiteral>] IDBTransaction =
inherit EventTarget
abstract db: IDBDatabase with get
abstract durability: IDBTransactionDuarability with get
abstract error: DOMException with get
abstract mode: IDBTransactionMode with get
abstract objectStoreNames: DOMStringList with get
abstract abort: unit -> unit
abstract objectStore: name: string -> IDBObjectStore
abstract commit: unit -> unit
abstract oncomplete: (Event -> unit) with get, set
abstract onerror: (Event -> unit) with get, set
abstract onabort: (Event -> unit) with get, set
type [<Global;AllowNullLiteral>] IDBRequest =
inherit EventTarget
abstract error: DOMException with get
abstract result: obj option with get
abstract source: IDBRequestSource option with get
abstract readyState: IDBRequestReadyState with get
abstract transaction: IDBTransaction with get
abstract onerror: (Event -> unit) with get, set
abstract onsuccess: (Event -> unit) with get, set
type [<Global;AllowNullLiteral>] IDBCreateIndexOptions =
abstract unique: bool with get, set
abstract multiEntry: bool with get, set
type [<Global;AllowNullLiteral>] IDBObjectStore =
abstract indexNames: DOMStringList with get
abstract keyPath: obj with get
abstract name: string with get
abstract transaction: IDBTransaction with get
abstract autoIncrement: bool with get
abstract add: value: obj * ?key: obj -> IDBRequest
abstract clear: unit -> IDBRequest
abstract count: ?query: IDBKeyRange -> IDBRequest
abstract createIndex: indexName: string * keyPath: string * ?options: IDBCreateIndexOptions -> IDBRequest
abstract delete: key: obj -> IDBRequest
abstract deleteIndex: string -> IDBRequest
abstract get: key: obj -> IDBRequest
abstract getKey: key: obj -> IDBRequest
abstract getAll: ?query: IDBKeyRange * ?count: int -> IDBRequest
abstract getAllKeys: ?query: IDBKeyRange * ?count: int -> IDBRequest
abstract index: string -> IDBIndex
abstract openCursor: ?range: IDBKeyRange * ?direction: IDBCursorDirection -> IDBRequest
abstract openKeyCursor: ?range: IDBKeyRange * ?direction: IDBCursorDirection -> IDBRequest
abstract put: item: obj * ?key: obj -> IDBRequest
type [<Global;AllowNullLiteral>] IDBCreateStoreOptions =
abstract keyPath: obj with get, set
abstract autoIncrement: bool with get, set
type [<Global;AllowNullLiteral>] IDBTransactionOptions =
abstract durability: IDBTransactionDuarability with get, set
type [<Global;AllowNullLiteral>] IDBDatabase =
inherit EventTarget
abstract name: string with get
abstract version: int64 with get
abstract objectStoreNames: DOMStringList with get
abstract close: unit -> unit
abstract createObjectStore: name: string * ?options: IDBCreateStoreOptions -> IDBObjectStore
abstract deleteObjectStore: name: string -> unit
abstract transaction: storeNames: #seq<string> * ?mode: IDBTransactionMode * ?options: IDBTransactionOptions -> IDBTransaction
abstract transaction: storeNames: string * ?mode: IDBTransactionMode * ?options: IDBTransactionOptions -> IDBTransaction
abstract onclose: (Event -> unit) with get, set
abstract onversionchange: (Event -> unit) with get, set
abstract onabort: (Event -> unit) with get, set
abstract onerror: (Event -> unit) with get, set
type [<Global;AllowNullLiteral>] IDBOpenDBRequest =
inherit IDBRequest
abstract blocked: (Event -> unit) with get, set
abstract onupgradeneeded: (IDBVersionChangeEvent -> unit) with get, set
type [<Global;AllowNullLiteral>] IDBFactory =
abstract ``open``: name: string * ?version: int -> IDBOpenDBRequest
abstract cmp: first: 'T * second: 'T -> int
abstract deleteDatabase: name: string -> IDBOpenDBRequest
abstract databases: unit -> JS.Promise<DatabasesType array>