OLD | NEW |
| (Empty) |
1 dart_library.library('dart/indexed_db', null, /* Imports */[ | |
2 'dart/_runtime', | |
3 'dart/core', | |
4 'dart/html_common', | |
5 'dart/_js_helper', | |
6 'dart/async', | |
7 'dart/_interceptors', | |
8 'dart/_metadata', | |
9 'dart/html' | |
10 ], /* Lazy imports */[ | |
11 ], function(exports, dart, core, html_common, _js_helper, async, _interceptors,
_metadata, html) { | |
12 'use strict'; | |
13 let dartx = dart.dartx; | |
14 class _KeyRangeFactoryProvider extends core.Object { | |
15 static createKeyRange_only(value) { | |
16 return _KeyRangeFactoryProvider._only(_KeyRangeFactoryProvider._class(), _
KeyRangeFactoryProvider._translateKey(value)); | |
17 } | |
18 static createKeyRange_lowerBound(bound, open) { | |
19 if (open === void 0) open = false; | |
20 return _KeyRangeFactoryProvider._lowerBound(_KeyRangeFactoryProvider._clas
s(), _KeyRangeFactoryProvider._translateKey(bound), open); | |
21 } | |
22 static createKeyRange_upperBound(bound, open) { | |
23 if (open === void 0) open = false; | |
24 return _KeyRangeFactoryProvider._upperBound(_KeyRangeFactoryProvider._clas
s(), _KeyRangeFactoryProvider._translateKey(bound), open); | |
25 } | |
26 static createKeyRange_bound(lower, upper, lowerOpen, upperOpen) { | |
27 if (lowerOpen === void 0) lowerOpen = false; | |
28 if (upperOpen === void 0) upperOpen = false; | |
29 return _KeyRangeFactoryProvider._bound(_KeyRangeFactoryProvider._class(),
_KeyRangeFactoryProvider._translateKey(lower), _KeyRangeFactoryProvider._transla
teKey(upper), lowerOpen, upperOpen); | |
30 } | |
31 static _class() { | |
32 if (_KeyRangeFactoryProvider._cachedClass != null) return _KeyRangeFactory
Provider._cachedClass; | |
33 return _KeyRangeFactoryProvider._cachedClass = _KeyRangeFactoryProvider._u
ncachedClass(); | |
34 } | |
35 static _uncachedClass() { | |
36 return window.webkitIDBKeyRange || window.mozIDBKeyRange || window.msIDBKe
yRange || window.IDBKeyRange; | |
37 } | |
38 static _translateKey(idbkey) { | |
39 return idbkey; | |
40 } | |
41 static _only(cls, value) { | |
42 return dart.as(cls.only(value), KeyRange); | |
43 } | |
44 static _lowerBound(cls, bound, open) { | |
45 return dart.as(cls.lowerBound(bound, open), KeyRange); | |
46 } | |
47 static _upperBound(cls, bound, open) { | |
48 return dart.as(cls.upperBound(bound, open), KeyRange); | |
49 } | |
50 static _bound(cls, lower, upper, lowerOpen, upperOpen) { | |
51 return dart.as(cls.bound(lower, upper, lowerOpen, upperOpen), KeyRange); | |
52 } | |
53 } | |
54 dart.setSignature(_KeyRangeFactoryProvider, { | |
55 statics: () => ({ | |
56 createKeyRange_only: [KeyRange, [dart.dynamic]], | |
57 createKeyRange_lowerBound: [KeyRange, [dart.dynamic], [core.bool]], | |
58 createKeyRange_upperBound: [KeyRange, [dart.dynamic], [core.bool]], | |
59 createKeyRange_bound: [KeyRange, [dart.dynamic, dart.dynamic], [core.bool,
core.bool]], | |
60 _class: [dart.dynamic, []], | |
61 _uncachedClass: [dart.dynamic, []], | |
62 _translateKey: [dart.dynamic, [dart.dynamic]], | |
63 _only: [KeyRange, [dart.dynamic, dart.dynamic]], | |
64 _lowerBound: [KeyRange, [dart.dynamic, dart.dynamic, dart.dynamic]], | |
65 _upperBound: [KeyRange, [dart.dynamic, dart.dynamic, dart.dynamic]], | |
66 _bound: [KeyRange, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic
, dart.dynamic]] | |
67 }), | |
68 names: ['createKeyRange_only', 'createKeyRange_lowerBound', 'createKeyRange_
upperBound', 'createKeyRange_bound', '_class', '_uncachedClass', '_translateKey'
, '_only', '_lowerBound', '_upperBound', '_bound'] | |
69 }); | |
70 _KeyRangeFactoryProvider._cachedClass = null; | |
71 function _convertNativeToDart_IDBKey(nativeKey) { | |
72 function containsDate(object) { | |
73 if (dart.notNull(html_common.isJavaScriptDate(object))) return true; | |
74 if (dart.is(object, core.List)) { | |
75 for (let i = 0; i < dart.notNull(object[dartx.length]); i++) { | |
76 if (dart.notNull(dart.as(containsDate(object[dartx.get](i)), core.bool
))) return true; | |
77 } | |
78 } | |
79 return false; | |
80 } | |
81 dart.fn(containsDate); | |
82 if (dart.notNull(dart.as(containsDate(nativeKey), core.bool))) { | |
83 dart.throw(new core.UnimplementedError('Key containing DateTime')); | |
84 } | |
85 return nativeKey; | |
86 } | |
87 dart.fn(_convertNativeToDart_IDBKey); | |
88 function _convertDartToNative_IDBKey(dartKey) { | |
89 return dartKey; | |
90 } | |
91 dart.fn(_convertDartToNative_IDBKey); | |
92 function _convertNativeToDart_IDBAny(object) { | |
93 return html_common.convertNativeToDart_AcceptStructuredClone(object, {mustCo
py: false}); | |
94 } | |
95 dart.fn(_convertNativeToDart_IDBAny); | |
96 const _idbKey = 'JSExtendableArray|=Object|num|String'; | |
97 const _annotation_Creates_IDBKey = dart.const(new _js_helper.Creates(_idbKey))
; | |
98 const _annotation_Returns_IDBKey = dart.const(new _js_helper.Returns(_idbKey))
; | |
99 const _delete = Symbol('_delete'); | |
100 const _update = Symbol('_update'); | |
101 const _update_1 = Symbol('_update_1'); | |
102 dart.defineExtensionNames([ | |
103 'delete', | |
104 'update', | |
105 'next', | |
106 'advance', | |
107 'continuePrimaryKey', | |
108 'direction', | |
109 'key', | |
110 'primaryKey', | |
111 'source' | |
112 ]); | |
113 class Cursor extends _interceptors.Interceptor { | |
114 [dartx.delete]() { | |
115 try { | |
116 return _completeRequest(this[_delete]()); | |
117 } catch (e) { | |
118 let stacktrace = dart.stackTrace(e); | |
119 return async.Future.error(e, stacktrace); | |
120 } | |
121 | |
122 } | |
123 [dartx.update](value) { | |
124 try { | |
125 return _completeRequest(this[_update](value)); | |
126 } catch (e) { | |
127 let stacktrace = dart.stackTrace(e); | |
128 return async.Future.error(e, stacktrace); | |
129 } | |
130 | |
131 } | |
132 [dartx.next](key) { | |
133 if (key === void 0) key = null; | |
134 if (key == null) { | |
135 this.continue(); | |
136 } else { | |
137 this.continue(key); | |
138 } | |
139 } | |
140 static _() { | |
141 dart.throw(new core.UnsupportedError("Not supported")); | |
142 } | |
143 get [dartx.direction]() { | |
144 return this.direction; | |
145 } | |
146 get [dartx.key]() { | |
147 return this.key; | |
148 } | |
149 get [dartx.primaryKey]() { | |
150 return this.primaryKey; | |
151 } | |
152 get [dartx.source]() { | |
153 return this.source; | |
154 } | |
155 [dartx.advance](count) { | |
156 return this.advance(count); | |
157 } | |
158 [dartx.continuePrimaryKey](key, primaryKey) { | |
159 return this.continuePrimaryKey(key, primaryKey); | |
160 } | |
161 [_delete]() { | |
162 return this.delete(); | |
163 } | |
164 [_update](value) { | |
165 let value_1 = html_common.convertDartToNative_SerializedScriptValue(value)
; | |
166 return this[_update_1](value_1); | |
167 } | |
168 [_update_1](value) { | |
169 return this.update(value); | |
170 } | |
171 } | |
172 dart.setSignature(Cursor, { | |
173 constructors: () => ({_: [Cursor, []]}), | |
174 methods: () => ({ | |
175 [dartx.delete]: [async.Future, []], | |
176 [dartx.update]: [async.Future, [dart.dynamic]], | |
177 [dartx.next]: [dart.void, [], [core.Object]], | |
178 [dartx.advance]: [dart.void, [core.int]], | |
179 [dartx.continuePrimaryKey]: [dart.void, [core.Object, core.Object]], | |
180 [_delete]: [Request, []], | |
181 [_update]: [Request, [dart.dynamic]], | |
182 [_update_1]: [Request, [dart.dynamic]] | |
183 }) | |
184 }); | |
185 Cursor[dart.metadata] = () => [dart.const(new _metadata.DomName('IDBCursor')),
dart.const(new _metadata.Unstable()), dart.const(new _js_helper.Native("IDBCurs
or"))]; | |
186 dart.registerExtension(dart.global.IDBCursor, Cursor); | |
187 const _get_value = Symbol('_get_value'); | |
188 dart.defineExtensionNames([ | |
189 'value' | |
190 ]); | |
191 class CursorWithValue extends Cursor { | |
192 static _() { | |
193 dart.throw(new core.UnsupportedError("Not supported")); | |
194 } | |
195 get [dartx.value]() { | |
196 return _convertNativeToDart_IDBAny(this[_get_value]); | |
197 } | |
198 get [_get_value]() { | |
199 return this.value; | |
200 } | |
201 } | |
202 dart.setSignature(CursorWithValue, { | |
203 constructors: () => ({_: [CursorWithValue, []]}) | |
204 }); | |
205 CursorWithValue[dart.metadata] = () => [dart.const(new _metadata.DocsEditable(
)), dart.const(new _metadata.DomName('IDBCursorWithValue')), dart.const(new _met
adata.Unstable()), dart.const(new _js_helper.Native("IDBCursorWithValue"))]; | |
206 dart.registerExtension(dart.global.IDBCursorWithValue, CursorWithValue); | |
207 const _createObjectStore = Symbol('_createObjectStore'); | |
208 const _transaction = Symbol('_transaction'); | |
209 const _createObjectStore_1 = Symbol('_createObjectStore_1'); | |
210 const _createObjectStore_2 = Symbol('_createObjectStore_2'); | |
211 dart.defineExtensionNames([ | |
212 'createObjectStore', | |
213 'transaction', | |
214 'transactionStore', | |
215 'transactionList', | |
216 'transactionStores', | |
217 'close', | |
218 'deleteObjectStore', | |
219 'onAbort', | |
220 'onClose', | |
221 'onError', | |
222 'onVersionChange', | |
223 'name', | |
224 'objectStoreNames', | |
225 'version' | |
226 ]); | |
227 class Database extends html.EventTarget { | |
228 [dartx.createObjectStore](name, opts) { | |
229 let keyPath = opts && 'keyPath' in opts ? opts.keyPath : null; | |
230 let autoIncrement = opts && 'autoIncrement' in opts ? opts.autoIncrement :
null; | |
231 let options = dart.map(); | |
232 if (keyPath != null) { | |
233 options[dartx.set]('keyPath', keyPath); | |
234 } | |
235 if (autoIncrement != null) { | |
236 options[dartx.set]('autoIncrement', autoIncrement); | |
237 } | |
238 return this[_createObjectStore](name, options); | |
239 } | |
240 [dartx.transaction](storeName_OR_storeNames, mode) { | |
241 if (mode != 'readonly' && mode != 'readwrite') { | |
242 dart.throw(new core.ArgumentError(mode)); | |
243 } | |
244 return this[_transaction](storeName_OR_storeNames, mode); | |
245 } | |
246 [dartx.transactionStore](storeName, mode) { | |
247 if (mode != 'readonly' && mode != 'readwrite') { | |
248 dart.throw(new core.ArgumentError(mode)); | |
249 } | |
250 return this[_transaction](storeName, mode); | |
251 } | |
252 [dartx.transactionList](storeNames, mode) { | |
253 if (mode != 'readonly' && mode != 'readwrite') { | |
254 dart.throw(new core.ArgumentError(mode)); | |
255 } | |
256 let storeNames_1 = html_common.convertDartToNative_StringArray(storeNames)
; | |
257 return this[_transaction](storeNames_1, mode); | |
258 } | |
259 [dartx.transactionStores](storeNames, mode) { | |
260 if (mode != 'readonly' && mode != 'readwrite') { | |
261 dart.throw(new core.ArgumentError(mode)); | |
262 } | |
263 return this[_transaction](storeNames, mode); | |
264 } | |
265 [_transaction](stores, mode) { | |
266 return this.transaction(stores, mode); | |
267 } | |
268 static _() { | |
269 dart.throw(new core.UnsupportedError("Not supported")); | |
270 } | |
271 get [dartx.name]() { | |
272 return this.name; | |
273 } | |
274 get [dartx.objectStoreNames]() { | |
275 return this.objectStoreNames; | |
276 } | |
277 get [dartx.version]() { | |
278 return this.version; | |
279 } | |
280 [dartx.close]() { | |
281 return this.close(); | |
282 } | |
283 [_createObjectStore](name, options) { | |
284 if (options === void 0) options = null; | |
285 if (options != null) { | |
286 let options_1 = html_common.convertDartToNative_Dictionary(options); | |
287 return this[_createObjectStore_1](name, options_1); | |
288 } | |
289 return this[_createObjectStore_2](name); | |
290 } | |
291 [_createObjectStore_1](name, options) { | |
292 return this.createObjectStore(name, options); | |
293 } | |
294 [_createObjectStore_2](name) { | |
295 return this.createObjectStore(name); | |
296 } | |
297 [dartx.deleteObjectStore](name) { | |
298 return this.deleteObjectStore(name); | |
299 } | |
300 get [dartx.onAbort]() { | |
301 return Database.abortEvent.forTarget(this); | |
302 } | |
303 get [dartx.onClose]() { | |
304 return Database.closeEvent.forTarget(this); | |
305 } | |
306 get [dartx.onError]() { | |
307 return Database.errorEvent.forTarget(this); | |
308 } | |
309 get [dartx.onVersionChange]() { | |
310 return Database.versionChangeEvent.forTarget(this); | |
311 } | |
312 } | |
313 dart.setSignature(Database, { | |
314 constructors: () => ({_: [Database, []]}), | |
315 methods: () => ({ | |
316 [dartx.createObjectStore]: [ObjectStore, [core.String], {keyPath: core.Str
ing, autoIncrement: core.bool}], | |
317 [dartx.transaction]: [Transaction, [dart.dynamic, core.String]], | |
318 [dartx.transactionStore]: [Transaction, [core.String, core.String]], | |
319 [dartx.transactionList]: [Transaction, [core.List$(core.String), core.Stri
ng]], | |
320 [dartx.transactionStores]: [Transaction, [html.DomStringList, core.String]
], | |
321 [_transaction]: [Transaction, [dart.dynamic, dart.dynamic]], | |
322 [dartx.close]: [dart.void, []], | |
323 [_createObjectStore]: [ObjectStore, [core.String], [core.Map]], | |
324 [_createObjectStore_1]: [ObjectStore, [dart.dynamic, dart.dynamic]], | |
325 [_createObjectStore_2]: [ObjectStore, [dart.dynamic]], | |
326 [dartx.deleteObjectStore]: [dart.void, [core.String]] | |
327 }) | |
328 }); | |
329 Database[dart.metadata] = () => [dart.const(new _metadata.DocsEditable()), dar
t.const(new _metadata.DomName('IDBDatabase')), dart.const(new _metadata.Supporte
dBrowser(_metadata.SupportedBrowser.CHROME)), dart.const(new _metadata.Supported
Browser(_metadata.SupportedBrowser.FIREFOX, '15')), dart.const(new _metadata.Sup
portedBrowser(_metadata.SupportedBrowser.IE, '10')), dart.const(new _metadata.Ex
perimental()), dart.const(new _metadata.Unstable()), dart.const(new _js_helper.N
ative("IDBDatabase"))]; | |
330 Database.abortEvent = dart.const(new (html.EventStreamProvider$(html.Event))('
abort')); | |
331 Database.closeEvent = dart.const(new (html.EventStreamProvider$(html.Event))('
close')); | |
332 Database.errorEvent = dart.const(new (html.EventStreamProvider$(html.Event))('
error')); | |
333 dart.defineLazyProperties(Database, { | |
334 get versionChangeEvent() { | |
335 return dart.const(new (html.EventStreamProvider$(VersionChangeEvent))('ver
sionchange')); | |
336 } | |
337 }); | |
338 dart.registerExtension(dart.global.IDBDatabase, Database); | |
339 const _open = Symbol('_open'); | |
340 const _deleteDatabase = Symbol('_deleteDatabase'); | |
341 const _webkitGetDatabaseNames = Symbol('_webkitGetDatabaseNames'); | |
342 dart.defineExtensionNames([ | |
343 'open', | |
344 'deleteDatabase', | |
345 'getDatabaseNames', | |
346 'supportsDatabaseNames', | |
347 'cmp' | |
348 ]); | |
349 class IdbFactory extends _interceptors.Interceptor { | |
350 static get supported() { | |
351 return !!(window.indexedDB || window.webkitIndexedDB || window.mozIndexedD
B); | |
352 } | |
353 [dartx.open](name, opts) { | |
354 let version = opts && 'version' in opts ? opts.version : null; | |
355 let onUpgradeNeeded = opts && 'onUpgradeNeeded' in opts ? opts.onUpgradeNe
eded : null; | |
356 let onBlocked = opts && 'onBlocked' in opts ? opts.onBlocked : null; | |
357 if (version == null != (onUpgradeNeeded == null)) { | |
358 return async.Future$(Database).error(new core.ArgumentError('version and
onUpgradeNeeded must be specified together')); | |
359 } | |
360 try { | |
361 let request = null; | |
362 if (version != null) { | |
363 request = this[_open](name, version); | |
364 } else { | |
365 request = this[_open](name); | |
366 } | |
367 if (onUpgradeNeeded != null) { | |
368 dart.dsend(dart.dload(request, 'onUpgradeNeeded'), 'listen', onUpgrade
Needed); | |
369 } | |
370 if (onBlocked != null) { | |
371 dart.dsend(dart.dload(request, 'onBlocked'), 'listen', onBlocked); | |
372 } | |
373 return dart.as(_completeRequest(dart.as(request, Request)), async.Future
$(Database)); | |
374 } catch (e) { | |
375 let stacktrace = dart.stackTrace(e); | |
376 return async.Future$(Database).error(e, stacktrace); | |
377 } | |
378 | |
379 } | |
380 [dartx.deleteDatabase](name, opts) { | |
381 let onBlocked = opts && 'onBlocked' in opts ? opts.onBlocked : null; | |
382 try { | |
383 let request = this[_deleteDatabase](name); | |
384 if (onBlocked != null) { | |
385 request[dartx.onBlocked].listen(dart.as(onBlocked, dart.functionType(d
art.void, [html.Event]))); | |
386 } | |
387 let completer = async.Completer.sync(); | |
388 request[dartx.onSuccess].listen(dart.fn(e => { | |
389 completer.complete(this); | |
390 }, dart.void, [html.Event])); | |
391 request[dartx.onError].listen(dart.bind(completer, 'completeError')); | |
392 return dart.as(completer.future, async.Future$(IdbFactory)); | |
393 } catch (e) { | |
394 let stacktrace = dart.stackTrace(e); | |
395 return async.Future$(IdbFactory).error(e, stacktrace); | |
396 } | |
397 | |
398 } | |
399 [dartx.getDatabaseNames]() { | |
400 try { | |
401 let request = this[_webkitGetDatabaseNames](); | |
402 return dart.as(_completeRequest(request), async.Future$(core.List$(core.
String))); | |
403 } catch (e) { | |
404 let stacktrace = dart.stackTrace(e); | |
405 return async.Future$(core.List$(core.String)).error(e, stacktrace); | |
406 } | |
407 | |
408 } | |
409 get [dartx.supportsDatabaseNames]() { | |
410 return dart.notNull(IdbFactory.supported) && !!(this.getDatabaseNames || t
his.webkitGetDatabaseNames); | |
411 } | |
412 static _() { | |
413 dart.throw(new core.UnsupportedError("Not supported")); | |
414 } | |
415 [dartx.cmp](first, second) { | |
416 return this.cmp(first, second); | |
417 } | |
418 [_deleteDatabase](name) { | |
419 return this.deleteDatabase(name); | |
420 } | |
421 [_open](name, version) { | |
422 return this.open(name, version); | |
423 } | |
424 [_webkitGetDatabaseNames]() { | |
425 return this.webkitGetDatabaseNames(); | |
426 } | |
427 } | |
428 dart.setSignature(IdbFactory, { | |
429 constructors: () => ({_: [IdbFactory, []]}), | |
430 methods: () => ({ | |
431 [dartx.open]: [async.Future$(Database), [core.String], {version: core.int,
onUpgradeNeeded: dart.functionType(dart.void, [dart.dynamic]), onBlocked: dart.
functionType(dart.void, [dart.dynamic])}], | |
432 [dartx.deleteDatabase]: [async.Future$(IdbFactory), [core.String], {onBloc
ked: dart.functionType(dart.void, [dart.dynamic])}], | |
433 [dartx.getDatabaseNames]: [async.Future$(core.List$(core.String)), []], | |
434 [dartx.cmp]: [core.int, [core.Object, core.Object]], | |
435 [_deleteDatabase]: [OpenDBRequest, [core.String]], | |
436 [_open]: [OpenDBRequest, [core.String], [core.int]], | |
437 [_webkitGetDatabaseNames]: [Request, []] | |
438 }) | |
439 }); | |
440 IdbFactory[dart.metadata] = () => [dart.const(new _metadata.DomName('IDBFactor
y')), dart.const(new _metadata.SupportedBrowser(_metadata.SupportedBrowser.CHROM
E)), dart.const(new _metadata.SupportedBrowser(_metadata.SupportedBrowser.FIREFO
X, '15')), dart.const(new _metadata.SupportedBrowser(_metadata.SupportedBrowser.
IE, '10')), dart.const(new _metadata.Experimental()), dart.const(new _metadata.U
nstable()), dart.const(new _js_helper.Native("IDBFactory"))]; | |
441 dart.registerExtension(dart.global.IDBFactory, IdbFactory); | |
442 function _completeRequest(request) { | |
443 let completer = async.Completer.sync(); | |
444 request[dartx.onSuccess].listen(dart.fn(e => { | |
445 completer.complete(request[dartx.result]); | |
446 }, dart.void, [html.Event])); | |
447 request[dartx.onError].listen(dart.bind(completer, 'completeError')); | |
448 return completer.future; | |
449 } | |
450 dart.fn(_completeRequest, () => dart.definiteFunctionType(async.Future, [Reque
st])); | |
451 const _count = Symbol('_count'); | |
452 const _get = Symbol('_get'); | |
453 const _getKey = Symbol('_getKey'); | |
454 const _openCursor = Symbol('_openCursor'); | |
455 const _openKeyCursor = Symbol('_openKeyCursor'); | |
456 dart.defineExtensionNames([ | |
457 'count', | |
458 'get', | |
459 'getKey', | |
460 'openCursor', | |
461 'openKeyCursor', | |
462 'keyPath', | |
463 'multiEntry', | |
464 'name', | |
465 'objectStore', | |
466 'unique' | |
467 ]); | |
468 class Index extends _interceptors.Interceptor { | |
469 [dartx.count](key_OR_range) { | |
470 if (key_OR_range === void 0) key_OR_range = null; | |
471 try { | |
472 let request = this[_count](key_OR_range); | |
473 return dart.as(_completeRequest(request), async.Future$(core.int)); | |
474 } catch (e) { | |
475 let stacktrace = dart.stackTrace(e); | |
476 return async.Future$(core.int).error(e, stacktrace); | |
477 } | |
478 | |
479 } | |
480 [dartx.get](key) { | |
481 try { | |
482 let request = this[_get](key); | |
483 return _completeRequest(request); | |
484 } catch (e) { | |
485 let stacktrace = dart.stackTrace(e); | |
486 return async.Future.error(e, stacktrace); | |
487 } | |
488 | |
489 } | |
490 [dartx.getKey](key) { | |
491 try { | |
492 let request = this[_getKey](key); | |
493 return _completeRequest(request); | |
494 } catch (e) { | |
495 let stacktrace = dart.stackTrace(e); | |
496 return async.Future.error(e, stacktrace); | |
497 } | |
498 | |
499 } | |
500 [dartx.openCursor](opts) { | |
501 let key = opts && 'key' in opts ? opts.key : null; | |
502 let range = opts && 'range' in opts ? opts.range : null; | |
503 let direction = opts && 'direction' in opts ? opts.direction : null; | |
504 let autoAdvance = opts && 'autoAdvance' in opts ? opts.autoAdvance : null; | |
505 let key_OR_range = null; | |
506 if (key != null) { | |
507 if (range != null) { | |
508 dart.throw(new core.ArgumentError('Cannot specify both key and range.'
)); | |
509 } | |
510 key_OR_range = key; | |
511 } else { | |
512 key_OR_range = range; | |
513 } | |
514 let request = null; | |
515 if (direction == null) { | |
516 request = this[_openCursor](key_OR_range, "next"); | |
517 } else { | |
518 request = this[_openCursor](key_OR_range, direction); | |
519 } | |
520 return dart.as(ObjectStore._cursorStreamFromResult(dart.as(request, Reques
t), autoAdvance), async.Stream$(CursorWithValue)); | |
521 } | |
522 [dartx.openKeyCursor](opts) { | |
523 let key = opts && 'key' in opts ? opts.key : null; | |
524 let range = opts && 'range' in opts ? opts.range : null; | |
525 let direction = opts && 'direction' in opts ? opts.direction : null; | |
526 let autoAdvance = opts && 'autoAdvance' in opts ? opts.autoAdvance : null; | |
527 let key_OR_range = null; | |
528 if (key != null) { | |
529 if (range != null) { | |
530 dart.throw(new core.ArgumentError('Cannot specify both key and range.'
)); | |
531 } | |
532 key_OR_range = key; | |
533 } else { | |
534 key_OR_range = range; | |
535 } | |
536 let request = null; | |
537 if (direction == null) { | |
538 request = this[_openKeyCursor](key_OR_range, "next"); | |
539 } else { | |
540 request = this[_openKeyCursor](key_OR_range, direction); | |
541 } | |
542 return ObjectStore._cursorStreamFromResult(dart.as(request, Request), auto
Advance); | |
543 } | |
544 static _() { | |
545 dart.throw(new core.UnsupportedError("Not supported")); | |
546 } | |
547 get [dartx.keyPath]() { | |
548 return this.keyPath; | |
549 } | |
550 get [dartx.multiEntry]() { | |
551 return this.multiEntry; | |
552 } | |
553 get [dartx.name]() { | |
554 return this.name; | |
555 } | |
556 get [dartx.objectStore]() { | |
557 return this.objectStore; | |
558 } | |
559 get [dartx.unique]() { | |
560 return this.unique; | |
561 } | |
562 [_count](key) { | |
563 return this.count(key); | |
564 } | |
565 [_get](key) { | |
566 return this.get(key); | |
567 } | |
568 [_getKey](key) { | |
569 return this.getKey(key); | |
570 } | |
571 [_openCursor](range, direction) { | |
572 return this.openCursor(range, direction); | |
573 } | |
574 [_openKeyCursor](range, direction) { | |
575 return this.openKeyCursor(range, direction); | |
576 } | |
577 } | |
578 dart.setSignature(Index, { | |
579 constructors: () => ({_: [Index, []]}), | |
580 methods: () => ({ | |
581 [dartx.count]: [async.Future$(core.int), [], [dart.dynamic]], | |
582 [dartx.get]: [async.Future, [dart.dynamic]], | |
583 [dartx.getKey]: [async.Future, [dart.dynamic]], | |
584 [dartx.openCursor]: [async.Stream$(CursorWithValue), [], {key: dart.dynami
c, range: KeyRange, direction: core.String, autoAdvance: core.bool}], | |
585 [dartx.openKeyCursor]: [async.Stream$(Cursor), [], {key: dart.dynamic, ran
ge: KeyRange, direction: core.String, autoAdvance: core.bool}], | |
586 [_count]: [Request, [core.Object]], | |
587 [_get]: [Request, [core.Object]], | |
588 [_getKey]: [Request, [core.Object]], | |
589 [_openCursor]: [Request, [core.Object], [core.String]], | |
590 [_openKeyCursor]: [Request, [core.Object], [core.String]] | |
591 }) | |
592 }); | |
593 Index[dart.metadata] = () => [dart.const(new _metadata.DomName('IDBIndex')), d
art.const(new _metadata.Unstable()), dart.const(new _js_helper.Native("IDBIndex"
))]; | |
594 dart.registerExtension(dart.global.IDBIndex, Index); | |
595 dart.defineExtensionNames([ | |
596 'lower', | |
597 'lowerOpen', | |
598 'upper', | |
599 'upperOpen' | |
600 ]); | |
601 class KeyRange extends _interceptors.Interceptor { | |
602 static only(value) { | |
603 return _KeyRangeFactoryProvider.createKeyRange_only(value); | |
604 } | |
605 static lowerBound(bound, open) { | |
606 if (open === void 0) open = false; | |
607 return _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); | |
608 } | |
609 static upperBound(bound, open) { | |
610 if (open === void 0) open = false; | |
611 return _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); | |
612 } | |
613 static bound(lower, upper, lowerOpen, upperOpen) { | |
614 if (lowerOpen === void 0) lowerOpen = false; | |
615 if (upperOpen === void 0) upperOpen = false; | |
616 return _KeyRangeFactoryProvider.createKeyRange_bound(lower, upper, lowerOp
en, upperOpen); | |
617 } | |
618 static _() { | |
619 dart.throw(new core.UnsupportedError("Not supported")); | |
620 } | |
621 get [dartx.lower]() { | |
622 return this.lower; | |
623 } | |
624 get [dartx.lowerOpen]() { | |
625 return this.lowerOpen; | |
626 } | |
627 get [dartx.upper]() { | |
628 return this.upper; | |
629 } | |
630 get [dartx.upperOpen]() { | |
631 return this.upperOpen; | |
632 } | |
633 } | |
634 dart.setSignature(KeyRange, { | |
635 constructors: () => ({ | |
636 only: [KeyRange, [dart.dynamic]], | |
637 lowerBound: [KeyRange, [dart.dynamic], [core.bool]], | |
638 upperBound: [KeyRange, [dart.dynamic], [core.bool]], | |
639 bound: [KeyRange, [dart.dynamic, dart.dynamic], [core.bool, core.bool]], | |
640 _: [KeyRange, []] | |
641 }), | |
642 statics: () => ({ | |
643 bound_: [KeyRange, [core.Object, core.Object], [core.bool, core.bool]], | |
644 lowerBound_: [KeyRange, [core.Object], [core.bool]], | |
645 only_: [KeyRange, [core.Object]], | |
646 upperBound_: [KeyRange, [core.Object], [core.bool]] | |
647 }), | |
648 names: ['bound_', 'lowerBound_', 'only_', 'upperBound_'] | |
649 }); | |
650 KeyRange[dart.metadata] = () => [dart.const(new _metadata.DomName('IDBKeyRange
')), dart.const(new _metadata.Unstable()), dart.const(new _js_helper.Native("IDB
KeyRange"))]; | |
651 dart.registerExtension(dart.global.IDBKeyRange, KeyRange); | |
652 const _add = Symbol('_add'); | |
653 const _clear = Symbol('_clear'); | |
654 const _put = Symbol('_put'); | |
655 const _createIndex = Symbol('_createIndex'); | |
656 const _add_1 = Symbol('_add_1'); | |
657 const _add_2 = Symbol('_add_2'); | |
658 const _createIndex_1 = Symbol('_createIndex_1'); | |
659 const _createIndex_2 = Symbol('_createIndex_2'); | |
660 const _createIndex_3 = Symbol('_createIndex_3'); | |
661 const _createIndex_4 = Symbol('_createIndex_4'); | |
662 const _put_1 = Symbol('_put_1'); | |
663 const _put_2 = Symbol('_put_2'); | |
664 dart.defineExtensionNames([ | |
665 'add', | |
666 'clear', | |
667 'delete', | |
668 'count', | |
669 'put', | |
670 'getObject', | |
671 'openCursor', | |
672 'createIndex', | |
673 'deleteIndex', | |
674 'index', | |
675 'openKeyCursor', | |
676 'autoIncrement', | |
677 'indexNames', | |
678 'keyPath', | |
679 'name', | |
680 'transaction' | |
681 ]); | |
682 class ObjectStore extends _interceptors.Interceptor { | |
683 [dartx.add](value, key) { | |
684 if (key === void 0) key = null; | |
685 try { | |
686 let request = null; | |
687 if (key != null) { | |
688 request = this[_add](value, key); | |
689 } else { | |
690 request = this[_add](value); | |
691 } | |
692 return _completeRequest(dart.as(request, Request)); | |
693 } catch (e) { | |
694 let stacktrace = dart.stackTrace(e); | |
695 return async.Future.error(e, stacktrace); | |
696 } | |
697 | |
698 } | |
699 [dartx.clear]() { | |
700 try { | |
701 return _completeRequest(this[_clear]()); | |
702 } catch (e) { | |
703 let stacktrace = dart.stackTrace(e); | |
704 return async.Future.error(e, stacktrace); | |
705 } | |
706 | |
707 } | |
708 [dartx.delete](key_OR_keyRange) { | |
709 try { | |
710 return _completeRequest(this[_delete](key_OR_keyRange)); | |
711 } catch (e) { | |
712 let stacktrace = dart.stackTrace(e); | |
713 return async.Future.error(e, stacktrace); | |
714 } | |
715 | |
716 } | |
717 [dartx.count](key_OR_range) { | |
718 if (key_OR_range === void 0) key_OR_range = null; | |
719 try { | |
720 let request = this[_count](key_OR_range); | |
721 return dart.as(_completeRequest(request), async.Future$(core.int)); | |
722 } catch (e) { | |
723 let stacktrace = dart.stackTrace(e); | |
724 return async.Future$(core.int).error(e, stacktrace); | |
725 } | |
726 | |
727 } | |
728 [dartx.put](value, key) { | |
729 if (key === void 0) key = null; | |
730 try { | |
731 let request = null; | |
732 if (key != null) { | |
733 request = this[_put](value, key); | |
734 } else { | |
735 request = this[_put](value); | |
736 } | |
737 return _completeRequest(dart.as(request, Request)); | |
738 } catch (e) { | |
739 let stacktrace = dart.stackTrace(e); | |
740 return async.Future.error(e, stacktrace); | |
741 } | |
742 | |
743 } | |
744 [dartx.getObject](key) { | |
745 try { | |
746 let request = this[_get](key); | |
747 return _completeRequest(request); | |
748 } catch (e) { | |
749 let stacktrace = dart.stackTrace(e); | |
750 return async.Future.error(e, stacktrace); | |
751 } | |
752 | |
753 } | |
754 [dartx.openCursor](opts) { | |
755 let key = opts && 'key' in opts ? opts.key : null; | |
756 let range = opts && 'range' in opts ? opts.range : null; | |
757 let direction = opts && 'direction' in opts ? opts.direction : null; | |
758 let autoAdvance = opts && 'autoAdvance' in opts ? opts.autoAdvance : null; | |
759 let key_OR_range = null; | |
760 if (key != null) { | |
761 if (range != null) { | |
762 dart.throw(new core.ArgumentError('Cannot specify both key and range.'
)); | |
763 } | |
764 key_OR_range = key; | |
765 } else { | |
766 key_OR_range = range; | |
767 } | |
768 let request = null; | |
769 if (direction == null) { | |
770 request = this[_openCursor](key_OR_range); | |
771 } else { | |
772 request = this[_openCursor](key_OR_range, direction); | |
773 } | |
774 return dart.as(ObjectStore._cursorStreamFromResult(dart.as(request, Reques
t), autoAdvance), async.Stream$(CursorWithValue)); | |
775 } | |
776 [dartx.createIndex](name, keyPath, opts) { | |
777 let unique = opts && 'unique' in opts ? opts.unique : null; | |
778 let multiEntry = opts && 'multiEntry' in opts ? opts.multiEntry : null; | |
779 let options = dart.map(); | |
780 if (unique != null) { | |
781 options[dartx.set]('unique', unique); | |
782 } | |
783 if (multiEntry != null) { | |
784 options[dartx.set]('multiEntry', multiEntry); | |
785 } | |
786 return this[_createIndex](name, keyPath, options); | |
787 } | |
788 static _() { | |
789 dart.throw(new core.UnsupportedError("Not supported")); | |
790 } | |
791 get [dartx.autoIncrement]() { | |
792 return this.autoIncrement; | |
793 } | |
794 get [dartx.indexNames]() { | |
795 return this.indexNames; | |
796 } | |
797 get [dartx.keyPath]() { | |
798 return this.keyPath; | |
799 } | |
800 get [dartx.name]() { | |
801 return this.name; | |
802 } | |
803 get [dartx.transaction]() { | |
804 return this.transaction; | |
805 } | |
806 [_add](value, key) { | |
807 if (key === void 0) key = null; | |
808 if (key != null) { | |
809 let value_1 = html_common.convertDartToNative_SerializedScriptValue(valu
e); | |
810 let key_2 = html_common.convertDartToNative_SerializedScriptValue(key); | |
811 return this[_add_1](value_1, key_2); | |
812 } | |
813 let value_1 = html_common.convertDartToNative_SerializedScriptValue(value)
; | |
814 return this[_add_2](value_1); | |
815 } | |
816 [_add_1](value, key) { | |
817 return this.add(value, key); | |
818 } | |
819 [_add_2](value) { | |
820 return this.add(value); | |
821 } | |
822 [_clear]() { | |
823 return this.clear(); | |
824 } | |
825 [_count](key) { | |
826 return this.count(key); | |
827 } | |
828 [_createIndex](name, keyPath, options) { | |
829 if (options === void 0) options = null; | |
830 if ((typeof keyPath == 'string' || keyPath == null) && options == null) { | |
831 return this[_createIndex_1](name, dart.as(keyPath, core.String)); | |
832 } | |
833 if (options != null && (typeof keyPath == 'string' || keyPath == null)) { | |
834 let options_1 = html_common.convertDartToNative_Dictionary(options); | |
835 return this[_createIndex_2](name, dart.as(keyPath, core.String), options
_1); | |
836 } | |
837 if ((dart.is(keyPath, core.List$(core.String)) || keyPath == null) && opti
ons == null) { | |
838 let keyPath_1 = html_common.convertDartToNative_StringArray(dart.as(keyP
ath, core.List$(core.String))); | |
839 return this[_createIndex_3](name, keyPath_1); | |
840 } | |
841 if (options != null && (dart.is(keyPath, core.List$(core.String)) || keyPa
th == null)) { | |
842 let keyPath_1 = html_common.convertDartToNative_StringArray(dart.as(keyP
ath, core.List$(core.String))); | |
843 let options_2 = html_common.convertDartToNative_Dictionary(options); | |
844 return this[_createIndex_4](name, keyPath_1, options_2); | |
845 } | |
846 dart.throw(new core.ArgumentError("Incorrect number or type of arguments")
); | |
847 } | |
848 [_createIndex_1](name, keyPath) { | |
849 return this.createIndex(name, keyPath); | |
850 } | |
851 [_createIndex_2](name, keyPath, options) { | |
852 return this.createIndex(name, keyPath, options); | |
853 } | |
854 [_createIndex_3](name, keyPath) { | |
855 return this.createIndex(name, keyPath); | |
856 } | |
857 [_createIndex_4](name, keyPath, options) { | |
858 return this.createIndex(name, keyPath, options); | |
859 } | |
860 [_delete](key) { | |
861 return this.delete(key); | |
862 } | |
863 [dartx.deleteIndex](name) { | |
864 return this.deleteIndex(name); | |
865 } | |
866 [_get](key) { | |
867 return this.get(key); | |
868 } | |
869 [dartx.index](name) { | |
870 return this.index(name); | |
871 } | |
872 [_openCursor](range, direction) { | |
873 return this.openCursor(range, direction); | |
874 } | |
875 [dartx.openKeyCursor](range, direction) { | |
876 return this.openKeyCursor(range, direction); | |
877 } | |
878 [_put](value, key) { | |
879 if (key === void 0) key = null; | |
880 if (key != null) { | |
881 let value_1 = html_common.convertDartToNative_SerializedScriptValue(valu
e); | |
882 let key_2 = html_common.convertDartToNative_SerializedScriptValue(key); | |
883 return this[_put_1](value_1, key_2); | |
884 } | |
885 let value_1 = html_common.convertDartToNative_SerializedScriptValue(value)
; | |
886 return this[_put_2](value_1); | |
887 } | |
888 [_put_1](value, key) { | |
889 return this.put(value, key); | |
890 } | |
891 [_put_2](value) { | |
892 return this.put(value); | |
893 } | |
894 static _cursorStreamFromResult(request, autoAdvance) { | |
895 let controller = async.StreamController.new({sync: true}); | |
896 request[dartx.onError].listen(dart.bind(controller, 'addError')); | |
897 request[dartx.onSuccess].listen(dart.fn(e => { | |
898 let cursor = dart.as(request[dartx.result], Cursor); | |
899 if (cursor == null) { | |
900 controller.close(); | |
901 } else { | |
902 controller.add(cursor); | |
903 if (autoAdvance == true && dart.notNull(controller.hasListener)) { | |
904 cursor[dartx.next](); | |
905 } | |
906 } | |
907 }, dart.void, [html.Event])); | |
908 return dart.as(controller.stream, async.Stream$(Cursor)); | |
909 } | |
910 } | |
911 dart.setSignature(ObjectStore, { | |
912 constructors: () => ({_: [ObjectStore, []]}), | |
913 methods: () => ({ | |
914 [dartx.add]: [async.Future, [dart.dynamic], [dart.dynamic]], | |
915 [dartx.clear]: [async.Future, []], | |
916 [dartx.delete]: [async.Future, [dart.dynamic]], | |
917 [dartx.count]: [async.Future$(core.int), [], [dart.dynamic]], | |
918 [dartx.put]: [async.Future, [dart.dynamic], [dart.dynamic]], | |
919 [dartx.getObject]: [async.Future, [dart.dynamic]], | |
920 [dartx.openCursor]: [async.Stream$(CursorWithValue), [], {key: dart.dynami
c, range: KeyRange, direction: core.String, autoAdvance: core.bool}], | |
921 [dartx.createIndex]: [Index, [core.String, dart.dynamic], {unique: core.bo
ol, multiEntry: core.bool}], | |
922 [_add]: [Request, [dart.dynamic], [dart.dynamic]], | |
923 [_add_1]: [Request, [dart.dynamic, dart.dynamic]], | |
924 [_add_2]: [Request, [dart.dynamic]], | |
925 [_clear]: [Request, []], | |
926 [_count]: [Request, [core.Object]], | |
927 [_createIndex]: [Index, [core.String, dart.dynamic], [core.Map]], | |
928 [_createIndex_1]: [Index, [dart.dynamic, core.String]], | |
929 [_createIndex_2]: [Index, [dart.dynamic, core.String, dart.dynamic]], | |
930 [_createIndex_3]: [Index, [dart.dynamic, core.List]], | |
931 [_createIndex_4]: [Index, [dart.dynamic, core.List, dart.dynamic]], | |
932 [_delete]: [Request, [core.Object]], | |
933 [dartx.deleteIndex]: [dart.void, [core.String]], | |
934 [_get]: [Request, [core.Object]], | |
935 [dartx.index]: [Index, [core.String]], | |
936 [_openCursor]: [Request, [core.Object], [core.String]], | |
937 [dartx.openKeyCursor]: [Request, [core.Object], [core.String]], | |
938 [_put]: [Request, [dart.dynamic], [dart.dynamic]], | |
939 [_put_1]: [Request, [dart.dynamic, dart.dynamic]], | |
940 [_put_2]: [Request, [dart.dynamic]] | |
941 }), | |
942 statics: () => ({_cursorStreamFromResult: [async.Stream$(Cursor), [Request,
core.bool]]}), | |
943 names: ['_cursorStreamFromResult'] | |
944 }); | |
945 ObjectStore[dart.metadata] = () => [dart.const(new _metadata.DomName('IDBObjec
tStore')), dart.const(new _metadata.Unstable()), dart.const(new _js_helper.Nativ
e("IDBObjectStore"))]; | |
946 dart.registerExtension(dart.global.IDBObjectStore, ObjectStore); | |
947 const _get_result = Symbol('_get_result'); | |
948 dart.defineExtensionNames([ | |
949 'result', | |
950 'onError', | |
951 'onSuccess', | |
952 'error', | |
953 'readyState', | |
954 'source', | |
955 'transaction' | |
956 ]); | |
957 class Request extends html.EventTarget { | |
958 static _() { | |
959 dart.throw(new core.UnsupportedError("Not supported")); | |
960 } | |
961 get [dartx.error]() { | |
962 return this.error; | |
963 } | |
964 get [dartx.readyState]() { | |
965 return this.readyState; | |
966 } | |
967 get [dartx.result]() { | |
968 return _convertNativeToDart_IDBAny(this[_get_result]); | |
969 } | |
970 get [_get_result]() { | |
971 return this.result; | |
972 } | |
973 get [dartx.source]() { | |
974 return this.source; | |
975 } | |
976 get [dartx.transaction]() { | |
977 return this.transaction; | |
978 } | |
979 get [dartx.onError]() { | |
980 return Request.errorEvent.forTarget(this); | |
981 } | |
982 get [dartx.onSuccess]() { | |
983 return Request.successEvent.forTarget(this); | |
984 } | |
985 } | |
986 dart.setSignature(Request, { | |
987 constructors: () => ({_: [Request, []]}) | |
988 }); | |
989 Request[dart.metadata] = () => [dart.const(new _metadata.DocsEditable()), dart
.const(new _metadata.DomName('IDBRequest')), dart.const(new _metadata.Unstable()
), dart.const(new _js_helper.Native("IDBRequest"))]; | |
990 Request.errorEvent = dart.const(new (html.EventStreamProvider$(html.Event))('e
rror')); | |
991 Request.successEvent = dart.const(new (html.EventStreamProvider$(html.Event))(
'success')); | |
992 dart.registerExtension(dart.global.IDBRequest, Request); | |
993 dart.defineExtensionNames([ | |
994 'onBlocked', | |
995 'onUpgradeNeeded' | |
996 ]); | |
997 class OpenDBRequest extends Request { | |
998 static _() { | |
999 dart.throw(new core.UnsupportedError("Not supported")); | |
1000 } | |
1001 get [dartx.onBlocked]() { | |
1002 return OpenDBRequest.blockedEvent.forTarget(this); | |
1003 } | |
1004 get [dartx.onUpgradeNeeded]() { | |
1005 return OpenDBRequest.upgradeNeededEvent.forTarget(this); | |
1006 } | |
1007 } | |
1008 dart.setSignature(OpenDBRequest, { | |
1009 constructors: () => ({_: [OpenDBRequest, []]}) | |
1010 }); | |
1011 OpenDBRequest[dart.metadata] = () => [dart.const(new _metadata.DocsEditable())
, dart.const(new _metadata.DomName('IDBOpenDBRequest')), dart.const(new _metadat
a.Unstable()), dart.const(new _js_helper.Native("IDBOpenDBRequest,IDBVersionChan
geRequest"))]; | |
1012 OpenDBRequest.blockedEvent = dart.const(new (html.EventStreamProvider$(html.Ev
ent))('blocked')); | |
1013 dart.defineLazyProperties(OpenDBRequest, { | |
1014 get upgradeNeededEvent() { | |
1015 return dart.const(new (html.EventStreamProvider$(VersionChangeEvent))('upg
radeneeded')); | |
1016 } | |
1017 }); | |
1018 dart.registerExtension(dart.global.IDBOpenDBRequest, OpenDBRequest); | |
1019 dart.defineExtensionNames([ | |
1020 'completed', | |
1021 'abort', | |
1022 'objectStore', | |
1023 'onAbort', | |
1024 'onComplete', | |
1025 'onError', | |
1026 'db', | |
1027 'error', | |
1028 'mode' | |
1029 ]); | |
1030 class Transaction extends html.EventTarget { | |
1031 get [dartx.completed]() { | |
1032 let completer = async.Completer$(Database).new(); | |
1033 this[dartx.onComplete].first.then(dart.fn(_ => { | |
1034 completer.complete(this[dartx.db]); | |
1035 }, dart.dynamic, [html.Event])); | |
1036 this[dartx.onError].first.then(dart.fn(e => { | |
1037 completer.completeError(e); | |
1038 }, dart.dynamic, [html.Event])); | |
1039 this[dartx.onAbort].first.then(dart.fn(e => { | |
1040 if (!dart.notNull(completer.isCompleted)) { | |
1041 completer.completeError(e); | |
1042 } | |
1043 }, dart.dynamic, [html.Event])); | |
1044 return completer.future; | |
1045 } | |
1046 static _() { | |
1047 dart.throw(new core.UnsupportedError("Not supported")); | |
1048 } | |
1049 get [dartx.db]() { | |
1050 return this.db; | |
1051 } | |
1052 get [dartx.error]() { | |
1053 return this.error; | |
1054 } | |
1055 get [dartx.mode]() { | |
1056 return this.mode; | |
1057 } | |
1058 [dartx.abort]() { | |
1059 return this.abort(); | |
1060 } | |
1061 [dartx.objectStore](name) { | |
1062 return this.objectStore(name); | |
1063 } | |
1064 get [dartx.onAbort]() { | |
1065 return Transaction.abortEvent.forTarget(this); | |
1066 } | |
1067 get [dartx.onComplete]() { | |
1068 return Transaction.completeEvent.forTarget(this); | |
1069 } | |
1070 get [dartx.onError]() { | |
1071 return Transaction.errorEvent.forTarget(this); | |
1072 } | |
1073 } | |
1074 dart.setSignature(Transaction, { | |
1075 constructors: () => ({_: [Transaction, []]}), | |
1076 methods: () => ({ | |
1077 [dartx.abort]: [dart.void, []], | |
1078 [dartx.objectStore]: [ObjectStore, [core.String]] | |
1079 }) | |
1080 }); | |
1081 Transaction[dart.metadata] = () => [dart.const(new _metadata.DomName('IDBTrans
action')), dart.const(new _metadata.Unstable()), dart.const(new _js_helper.Nativ
e("IDBTransaction"))]; | |
1082 Transaction.abortEvent = dart.const(new (html.EventStreamProvider$(html.Event)
)('abort')); | |
1083 Transaction.completeEvent = dart.const(new (html.EventStreamProvider$(html.Eve
nt))('complete')); | |
1084 Transaction.errorEvent = dart.const(new (html.EventStreamProvider$(html.Event)
)('error')); | |
1085 dart.registerExtension(dart.global.IDBTransaction, Transaction); | |
1086 dart.defineExtensionNames([ | |
1087 'dataLoss', | |
1088 'dataLossMessage', | |
1089 'newVersion', | |
1090 'oldVersion' | |
1091 ]); | |
1092 class VersionChangeEvent extends html.Event { | |
1093 static _() { | |
1094 dart.throw(new core.UnsupportedError("Not supported")); | |
1095 } | |
1096 get [dartx.dataLoss]() { | |
1097 return this.dataLoss; | |
1098 } | |
1099 get [dartx.dataLossMessage]() { | |
1100 return this.dataLossMessage; | |
1101 } | |
1102 get [dartx.newVersion]() { | |
1103 return this.newVersion; | |
1104 } | |
1105 get [dartx.oldVersion]() { | |
1106 return this.oldVersion; | |
1107 } | |
1108 } | |
1109 dart.setSignature(VersionChangeEvent, { | |
1110 constructors: () => ({_: [VersionChangeEvent, []]}) | |
1111 }); | |
1112 VersionChangeEvent[dart.metadata] = () => [dart.const(new _metadata.DocsEditab
le()), dart.const(new _metadata.DomName('IDBVersionChangeEvent')), dart.const(ne
w _metadata.Unstable()), dart.const(new _js_helper.Native("IDBVersionChangeEvent
"))]; | |
1113 dart.registerExtension(dart.global.IDBVersionChangeEvent, VersionChangeEvent); | |
1114 // Exports: | |
1115 exports.Cursor = Cursor; | |
1116 exports.CursorWithValue = CursorWithValue; | |
1117 exports.Database = Database; | |
1118 exports.IdbFactory = IdbFactory; | |
1119 exports.Index = Index; | |
1120 exports.KeyRange = KeyRange; | |
1121 exports.ObjectStore = ObjectStore; | |
1122 exports.Request = Request; | |
1123 exports.OpenDBRequest = OpenDBRequest; | |
1124 exports.Transaction = Transaction; | |
1125 exports.VersionChangeEvent = VersionChangeEvent; | |
1126 }); | |
OLD | NEW |