Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart

Issue 11419300: Dartifying dart:html type names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 library indexed_db;
2
3 import 'dart:html';
4 import 'dart:html_common';
5 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
6 // for details. All rights reserved. Use of this source code is governed by a
7 // BSD-style license that can be found in the LICENSE file.
8
9 // DO NOT EDIT
10 // Auto-generated dart:svg library.
11
12
13
14
15
16 class _KeyRangeFactoryProvider {
17
18 static KeyRange createKeyRange_only(/*Key*/ value) =>
19 _only(_class(), _translateKey(value));
20
21 static KeyRange createKeyRange_lowerBound(
22 /*Key*/ bound, [bool open = false]) =>
23 _lowerBound(_class(), _translateKey(bound), open);
24
25 static KeyRange createKeyRange_upperBound(
26 /*Key*/ bound, [bool open = false]) =>
27 _upperBound(_class(), _translateKey(bound), open);
28
29 static KeyRange createKeyRange_bound(/*Key*/ lower, /*Key*/ upper,
30 [bool lowerOpen = false, bool upperOpen = false]) =>
31 _bound(_class(), _translateKey(lower), _translateKey(upper),
32 lowerOpen, upperOpen);
33
34 static var _cachedClass;
35
36 static _class() {
37 if (_cachedClass != null) return _cachedClass;
38 return _cachedClass = _uncachedClass();
39 }
40
41 static _uncachedClass() =>
42 JS('var',
43 '''window.webkitIDBKeyRange || window.mozIDBKeyRange ||
44 window.msIDBKeyRange || window.IDBKeyRange''');
45
46 static _translateKey(idbkey) => idbkey; // TODO: fixme.
47
48 static KeyRange _only(cls, value) =>
49 JS('KeyRange', '#.only(#)', cls, value);
50
51 static KeyRange _lowerBound(cls, bound, open) =>
52 JS('KeyRange', '#.lowerBound(#, #)', cls, bound, open);
53
54 static KeyRange _upperBound(cls, bound, open) =>
55 JS('KeyRange', '#.upperBound(#, #)', cls, bound, open);
56
57 static KeyRange _bound(cls, lower, upper, lowerOpen, upperOpen) =>
58 JS('KeyRange', '#.bound(#, #, #, #)',
59 cls, lower, upper, lowerOpen, upperOpen);
60 }
61
62
63 /**
64 * Converts a native IDBKey into a Dart object.
65 *
66 * May return the original input. May mutate the original input (but will be
67 * idempotent if mutation occurs). It is assumed that this conversion happens
68 * on native IDBKeys on all paths that return IDBKeys from native DOM calls.
69 *
70 * If necessary, JavaScript Dates are converted into Dart Dates.
71 */
72 _convertNativeToDart_IDBKey(nativeKey) {
73 containsDate(object) {
74 if (isJavaScriptDate(object)) return true;
75 if (object is List) {
76 for (int i = 0; i < object.length; i++) {
77 if (containsDate(object[i])) return true;
78 }
79 }
80 return false; // number, string.
81 }
82 if (containsDate(nativeKey)) {
83 throw new UnimplementedError('Key containing Date');
84 }
85 // TODO: Cache conversion somewhere?
86 return nativeKey;
87 }
88
89 /**
90 * Converts a Dart object into a valid IDBKey.
91 *
92 * May return the original input. Does not mutate input.
93 *
94 * If necessary, [dartKey] may be copied to ensure all lists are converted into
95 * JavaScript Arrays and Dart Dates into JavaScript Dates.
96 */
97 _convertDartToNative_IDBKey(dartKey) {
98 // TODO: Implement.
99 return dartKey;
100 }
101
102
103
104 /// May modify original. If so, action is idempotent.
105 _convertNativeToDart_IDBAny(object) {
106 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false);
107 }
108
109
110 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add Date.
111 const _annotation_Creates_IDBKey = const Creates(_idbKey);
112 const _annotation_Returns_IDBKey = const Returns(_idbKey);
113 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
114 // for details. All rights reserved. Use of this source code is governed by a
115 // BSD-style license that can be found in the LICENSE file.
116
117
118 /// @domName IDBAny; @docsEditable true
119 class Any native "*IDBAny" {
120 }
121 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
122 // for details. All rights reserved. Use of this source code is governed by a
123 // BSD-style license that can be found in the LICENSE file.
124
125
126 /// @domName IDBCursor; @docsEditable true
127 class Cursor native "*IDBCursor" {
128
129 static const int NEXT = 0;
130
131 static const int NEXT_NO_DUPLICATE = 1;
132
133 static const int PREV = 2;
134
135 static const int PREV_NO_DUPLICATE = 3;
136
137 /// @domName IDBCursor.direction; @docsEditable true
138 final String direction;
139
140 /// @domName IDBCursor.key; @docsEditable true
141 @_annotation_Creates_IDBKey @_annotation_Returns_IDBKey
142 final Object key;
143
144 /// @domName IDBCursor.primaryKey; @docsEditable true
145 final Object primaryKey;
146
147 /// @domName IDBCursor.source; @docsEditable true
148 final dynamic source;
149
150 /// @domName IDBCursor.advance; @docsEditable true
151 void advance(int count) native;
152
153 /// @domName IDBCursor.continueFunction; @docsEditable true
154 void continueFunction([/*IDBKey*/ key]) {
155 if (?key) {
156 var key_1 = _convertDartToNative_IDBKey(key);
157 _continueFunction_1(key_1);
158 return;
159 }
160 _continueFunction_2();
161 return;
162 }
163 @JSName('continue')
164 void _continueFunction_1(key) native;
165 @JSName('continue')
166 void _continueFunction_2() native;
167
168 /// @domName IDBCursor.delete; @docsEditable true
169 Request delete() native;
170
171 /// @domName IDBCursor.update; @docsEditable true
172 Request update(/*any*/ value) {
173 var value_1 = convertDartToNative_SerializedScriptValue(value);
174 return _update_1(value_1);
175 }
176 @JSName('update')
177 Request _update_1(value) native;
178 }
179 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
180 // for details. All rights reserved. Use of this source code is governed by a
181 // BSD-style license that can be found in the LICENSE file.
182
183
184 /// @domName IDBCursorWithValue; @docsEditable true
185 class CursorWithValue extends Cursor native "*IDBCursorWithValue" {
186
187 /// @domName IDBCursorWithValue.value; @docsEditable true
188 @annotation_Creates_SerializedScriptValue @annotation_Returns_SerializedScript Value
189 final Object value;
190 }
191 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
192 // for details. All rights reserved. Use of this source code is governed by a
193 // BSD-style license that can be found in the LICENSE file.
194
195
196 /// @domName IDBDatabase
197 class Database extends EventTarget native "*IDBDatabase" {
198
199 Transaction transaction(storeName_OR_storeNames, String mode) {
200 if (mode != 'readonly' && mode != 'readwrite') {
201 throw new ArgumentError(mode);
202 }
203
204 // TODO(sra): Ensure storeName_OR_storeNames is a string or List<String>,
205 // and copy to JavaScript array if necessary.
206
207 if (_transaction_fn != null) {
208 return _transaction_fn(this, storeName_OR_storeNames, mode);
209 }
210
211 // Try and create a transaction with a string mode. Browsers that expect a
212 // numeric mode tend to convert the string into a number. This fails
213 // silently, resulting in zero ('readonly').
214 var txn = _transaction(storeName_OR_storeNames, mode);
215 if (_hasNumericMode(txn)) {
216 _transaction_fn = _transaction_numeric_mode;
217 txn = _transaction_fn(this, storeName_OR_storeNames, mode);
218 } else {
219 _transaction_fn = _transaction_string_mode;
220 }
221 return txn;
222 }
223
224 static Transaction _transaction_string_mode(Database db, stores, mode) {
225 return db._transaction(stores, mode);
226 }
227
228 static Transaction _transaction_numeric_mode(Database db, stores, mode) {
229 int intMode;
230 if (mode == 'readonly') intMode = Transaction.READ_ONLY;
231 if (mode == 'readwrite') intMode = Transaction.READ_WRITE;
232 return db._transaction(stores, intMode);
233 }
234
235 @JSName('transaction')
236 Transaction _transaction(stores, mode) native;
237
238 static bool _hasNumericMode(txn) =>
239 JS('bool', 'typeof(#.mode) === "number"', txn);
240
241
242 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
243 DatabaseEvents get on =>
244 new DatabaseEvents(this);
245
246 /// @domName IDBDatabase.name; @docsEditable true
247 final String name;
248
249 /// @domName IDBDatabase.objectStoreNames; @docsEditable true
250 @Returns('_DomStringList') @Creates('_DomStringList')
251 final List<String> objectStoreNames;
252
253 /// @domName IDBDatabase.version; @docsEditable true
254 final dynamic version;
255
256 /// @domName IDBDatabase.addEventListener; @docsEditable true
257 @JSName('addEventListener')
258 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native;
259
260 /// @domName IDBDatabase.close; @docsEditable true
261 void close() native;
262
263 /// @domName IDBDatabase.createObjectStore; @docsEditable true
264 ObjectStore createObjectStore(String name, [Map options]) {
265 if (?options) {
266 var options_1 = convertDartToNative_Dictionary(options);
267 return _createObjectStore_1(name, options_1);
268 }
269 return _createObjectStore_2(name);
270 }
271 @JSName('createObjectStore')
272 ObjectStore _createObjectStore_1(name, options) native;
273 @JSName('createObjectStore')
274 ObjectStore _createObjectStore_2(name) native;
275
276 /// @domName IDBDatabase.deleteObjectStore; @docsEditable true
277 void deleteObjectStore(String name) native;
278
279 /// @domName IDBDatabase.dispatchEvent; @docsEditable true
280 @JSName('dispatchEvent')
281 bool $dom_dispatchEvent(Event evt) native;
282
283 /// @domName IDBDatabase.removeEventListener; @docsEditable true
284 @JSName('removeEventListener')
285 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native;
286
287 /// @domName IDBDatabase.setVersion; @docsEditable true
288 VersionChangeRequest setVersion(String version) native;
289 }
290
291 // TODO(sra): This should be a static member of IDBTransaction but dart2js
292 // can't handle that. Move it back after dart2js is completely done.
293 var _transaction_fn; // Assigned one of the static methods.
294
295 class DatabaseEvents extends Events {
296 DatabaseEvents(EventTarget _ptr) : super(_ptr);
297
298 EventListenerList get abort => this['abort'];
299
300 EventListenerList get error => this['error'];
301
302 EventListenerList get versionChange => this['versionchange'];
303 }
304 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
305 // for details. All rights reserved. Use of this source code is governed by a
306 // BSD-style license that can be found in the LICENSE file.
307
308
309 /// @domName IDBDatabaseException; @docsEditable true
310 class DatabaseException native "*IDBDatabaseException" {
311
312 static const int ABORT_ERR = 20;
313
314 static const int CONSTRAINT_ERR = 4;
315
316 static const int DATA_ERR = 5;
317
318 static const int NON_TRANSIENT_ERR = 2;
319
320 static const int NOT_ALLOWED_ERR = 6;
321
322 static const int NOT_FOUND_ERR = 8;
323
324 static const int NO_ERR = 0;
325
326 static const int QUOTA_ERR = 22;
327
328 static const int READ_ONLY_ERR = 9;
329
330 static const int TIMEOUT_ERR = 23;
331
332 static const int TRANSACTION_INACTIVE_ERR = 7;
333
334 static const int UNKNOWN_ERR = 1;
335
336 static const int VER_ERR = 12;
337
338 /// @domName IDBDatabaseException.code; @docsEditable true
339 final int code;
340
341 /// @domName IDBDatabaseException.message; @docsEditable true
342 final String message;
343
344 /// @domName IDBDatabaseException.name; @docsEditable true
345 final String name;
346
347 /// @domName IDBDatabaseException.toString; @docsEditable true
348 String toString() native;
349 }
350 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
351 // for details. All rights reserved. Use of this source code is governed by a
352 // BSD-style license that can be found in the LICENSE file.
353
354
355 /// @domName IDBFactory; @docsEditable true
356 class IdbFactory native "*IDBFactory" {
357
358 /// @domName IDBFactory.cmp; @docsEditable true
359 int cmp(/*IDBKey*/ first, /*IDBKey*/ second) {
360 var first_1 = _convertDartToNative_IDBKey(first);
361 var second_2 = _convertDartToNative_IDBKey(second);
362 return _cmp_1(first_1, second_2);
363 }
364 @JSName('cmp')
365 int _cmp_1(first, second) native;
366
367 /// @domName IDBFactory.deleteDatabase; @docsEditable true
368 VersionChangeRequest deleteDatabase(String name) native;
369
370 /// @domName IDBFactory.open; @docsEditable true
371 @Returns('Request') @Creates('Request') @Creates('Database')
372 OpenDBRequest open(String name, [int version]) native;
373
374 /// @domName IDBFactory.webkitGetDatabaseNames; @docsEditable true
375 Request webkitGetDatabaseNames() native;
376 }
377 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
378 // for details. All rights reserved. Use of this source code is governed by a
379 // BSD-style license that can be found in the LICENSE file.
380
381
382 /// @domName IDBIndex; @docsEditable true
383 class Index native "*IDBIndex" {
384
385 /// @domName IDBIndex.keyPath; @docsEditable true
386 final dynamic keyPath;
387
388 /// @domName IDBIndex.multiEntry; @docsEditable true
389 final bool multiEntry;
390
391 /// @domName IDBIndex.name; @docsEditable true
392 final String name;
393
394 /// @domName IDBIndex.objectStore; @docsEditable true
395 final ObjectStore objectStore;
396
397 /// @domName IDBIndex.unique; @docsEditable true
398 final bool unique;
399
400 /// @domName IDBIndex.count; @docsEditable true
401 Request count([key_OR_range]) {
402 if (!?key_OR_range) {
403 return _count_1();
404 }
405 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null))) {
406 return _count_2(key_OR_range);
407 }
408 if (?key_OR_range) {
409 var key_1 = _convertDartToNative_IDBKey(key_OR_range);
410 return _count_3(key_1);
411 }
412 throw new ArgumentError("Incorrect number or type of arguments");
413 }
414 @JSName('count')
415 Request _count_1() native;
416 @JSName('count')
417 Request _count_2(KeyRange range) native;
418 @JSName('count')
419 Request _count_3(key) native;
420
421 /// @domName IDBIndex.get; @docsEditable true
422 Request get(key) {
423 if ((?key && (key is KeyRange || key == null))) {
424 return _get_1(key);
425 }
426 if (?key) {
427 var key_1 = _convertDartToNative_IDBKey(key);
428 return _get_2(key_1);
429 }
430 throw new ArgumentError("Incorrect number or type of arguments");
431 }
432 @JSName('get')
433 @Returns('Request') @Creates('Request') @annotation_Creates_SerializedScriptVa lue
434 Request _get_1(KeyRange key) native;
435 @JSName('get')
436 @Returns('Request') @Creates('Request') @annotation_Creates_SerializedScriptVa lue
437 Request _get_2(key) native;
438
439 /// @domName IDBIndex.getKey; @docsEditable true
440 Request getKey(key) {
441 if ((?key && (key is KeyRange || key == null))) {
442 return _getKey_1(key);
443 }
444 if (?key) {
445 var key_1 = _convertDartToNative_IDBKey(key);
446 return _getKey_2(key_1);
447 }
448 throw new ArgumentError("Incorrect number or type of arguments");
449 }
450 @JSName('getKey')
451 @Returns('Request') @Creates('Request') @annotation_Creates_SerializedScriptVa lue @Creates('ObjectStore')
452 Request _getKey_1(KeyRange key) native;
453 @JSName('getKey')
454 @Returns('Request') @Creates('Request') @annotation_Creates_SerializedScriptVa lue @Creates('ObjectStore')
455 Request _getKey_2(key) native;
456
457 /// @domName IDBIndex.openCursor; @docsEditable true
458 Request openCursor([key_OR_range, String direction]) {
459 if (!?key_OR_range &&
460 !?direction) {
461 return _openCursor_1();
462 }
463 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null)) &&
464 !?direction) {
465 return _openCursor_2(key_OR_range);
466 }
467 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null))) {
468 return _openCursor_3(key_OR_range, direction);
469 }
470 if (?key_OR_range &&
471 !?direction) {
472 var key_1 = _convertDartToNative_IDBKey(key_OR_range);
473 return _openCursor_4(key_1);
474 }
475 if (?key_OR_range) {
476 var key_2 = _convertDartToNative_IDBKey(key_OR_range);
477 return _openCursor_5(key_2, direction);
478 }
479 throw new ArgumentError("Incorrect number or type of arguments");
480 }
481 @JSName('openCursor')
482 @Returns('Request') @Creates('Request') @Creates('Cursor')
483 Request _openCursor_1() native;
484 @JSName('openCursor')
485 @Returns('Request') @Creates('Request') @Creates('Cursor')
486 Request _openCursor_2(KeyRange range) native;
487 @JSName('openCursor')
488 @Returns('Request') @Creates('Request') @Creates('Cursor')
489 Request _openCursor_3(KeyRange range, direction) native;
490 @JSName('openCursor')
491 @Returns('Request') @Creates('Request') @Creates('Cursor')
492 Request _openCursor_4(key) native;
493 @JSName('openCursor')
494 @Returns('Request') @Creates('Request') @Creates('Cursor')
495 Request _openCursor_5(key, direction) native;
496
497 /// @domName IDBIndex.openKeyCursor; @docsEditable true
498 Request openKeyCursor([key_OR_range, String direction]) {
499 if (!?key_OR_range &&
500 !?direction) {
501 return _openKeyCursor_1();
502 }
503 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null)) &&
504 !?direction) {
505 return _openKeyCursor_2(key_OR_range);
506 }
507 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null))) {
508 return _openKeyCursor_3(key_OR_range, direction);
509 }
510 if (?key_OR_range &&
511 !?direction) {
512 var key_1 = _convertDartToNative_IDBKey(key_OR_range);
513 return _openKeyCursor_4(key_1);
514 }
515 if (?key_OR_range) {
516 var key_2 = _convertDartToNative_IDBKey(key_OR_range);
517 return _openKeyCursor_5(key_2, direction);
518 }
519 throw new ArgumentError("Incorrect number or type of arguments");
520 }
521 @JSName('openKeyCursor')
522 @Returns('Request') @Creates('Request') @Creates('Cursor')
523 Request _openKeyCursor_1() native;
524 @JSName('openKeyCursor')
525 @Returns('Request') @Creates('Request') @Creates('Cursor')
526 Request _openKeyCursor_2(KeyRange range) native;
527 @JSName('openKeyCursor')
528 @Returns('Request') @Creates('Request') @Creates('Cursor')
529 Request _openKeyCursor_3(KeyRange range, direction) native;
530 @JSName('openKeyCursor')
531 @Returns('Request') @Creates('Request') @Creates('Cursor')
532 Request _openKeyCursor_4(key) native;
533 @JSName('openKeyCursor')
534 @Returns('Request') @Creates('Request') @Creates('Cursor')
535 Request _openKeyCursor_5(key, direction) native;
536 }
537 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
538 // for details. All rights reserved. Use of this source code is governed by a
539 // BSD-style license that can be found in the LICENSE file.
540
541
542 /// @domName IDBKey; @docsEditable true
543 class Key native "*IDBKey" {
544 }
545 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
546 // for details. All rights reserved. Use of this source code is governed by a
547 // BSD-style license that can be found in the LICENSE file.
548
549
550 /// @domName IDBKeyRange
551 class KeyRange native "*IDBKeyRange" {
552 /**
553 * @domName IDBKeyRange.only
554 */
555 factory KeyRange.only(/*Key*/ value) =>
556 _KeyRangeFactoryProvider.createKeyRange_only(value);
557
558 /**
559 * @domName IDBKeyRange.lowerBound
560 */
561 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) =>
562 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open);
563
564 /**
565 * @domName IDBKeyRange.upperBound
566 */
567 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) =>
568 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open);
569
570 /**
571 * @domName KeyRange.bound
572 */
573 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper,
574 [bool lowerOpen = false, bool upperOpen = false]) =>
575 _KeyRangeFactoryProvider.createKeyRange_bound(
576 lower, upper, lowerOpen, upperOpen);
577
578
579 /// @domName IDBKeyRange.lower; @docsEditable true
580 dynamic get lower => _convertNativeToDart_IDBKey(this._lower);
581 @JSName('lower')
582 final dynamic _lower;
583
584 /// @domName IDBKeyRange.lowerOpen; @docsEditable true
585 final bool lowerOpen;
586
587 /// @domName IDBKeyRange.upper; @docsEditable true
588 dynamic get upper => _convertNativeToDart_IDBKey(this._upper);
589 @JSName('upper')
590 final dynamic _upper;
591
592 /// @domName IDBKeyRange.upperOpen; @docsEditable true
593 final bool upperOpen;
594
595 /// @domName IDBKeyRange.bound_; @docsEditable true
596 static KeyRange bound_(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen, bo ol upperOpen]) {
597 if (?upperOpen) {
598 var lower_1 = _convertDartToNative_IDBKey(lower);
599 var upper_2 = _convertDartToNative_IDBKey(upper);
600 return _bound__1(lower_1, upper_2, lowerOpen, upperOpen);
601 }
602 if (?lowerOpen) {
603 var lower_3 = _convertDartToNative_IDBKey(lower);
604 var upper_4 = _convertDartToNative_IDBKey(upper);
605 return _bound__2(lower_3, upper_4, lowerOpen);
606 }
607 var lower_5 = _convertDartToNative_IDBKey(lower);
608 var upper_6 = _convertDartToNative_IDBKey(upper);
609 return _bound__3(lower_5, upper_6);
610 }
611 @JSName('bound')
612 static KeyRange _bound__1(lower, upper, lowerOpen, upperOpen) native;
613 @JSName('bound')
614 static KeyRange _bound__2(lower, upper, lowerOpen) native;
615 @JSName('bound')
616 static KeyRange _bound__3(lower, upper) native;
617
618 /// @domName IDBKeyRange.lowerBound_; @docsEditable true
619 static KeyRange lowerBound_(/*IDBKey*/ bound, [bool open]) {
620 if (?open) {
621 var bound_1 = _convertDartToNative_IDBKey(bound);
622 return _lowerBound__1(bound_1, open);
623 }
624 var bound_2 = _convertDartToNative_IDBKey(bound);
625 return _lowerBound__2(bound_2);
626 }
627 @JSName('lowerBound')
628 static KeyRange _lowerBound__1(bound, open) native;
629 @JSName('lowerBound')
630 static KeyRange _lowerBound__2(bound) native;
631
632 /// @domName IDBKeyRange.only_; @docsEditable true
633 static KeyRange only_(/*IDBKey*/ value) {
634 var value_1 = _convertDartToNative_IDBKey(value);
635 return _only__1(value_1);
636 }
637 @JSName('only')
638 static KeyRange _only__1(value) native;
639
640 /// @domName IDBKeyRange.upperBound_; @docsEditable true
641 static KeyRange upperBound_(/*IDBKey*/ bound, [bool open]) {
642 if (?open) {
643 var bound_1 = _convertDartToNative_IDBKey(bound);
644 return _upperBound__1(bound_1, open);
645 }
646 var bound_2 = _convertDartToNative_IDBKey(bound);
647 return _upperBound__2(bound_2);
648 }
649 @JSName('upperBound')
650 static KeyRange _upperBound__1(bound, open) native;
651 @JSName('upperBound')
652 static KeyRange _upperBound__2(bound) native;
653
654 }
655 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
656 // for details. All rights reserved. Use of this source code is governed by a
657 // BSD-style license that can be found in the LICENSE file.
658
659
660 /// @domName IDBObjectStore; @docsEditable true
661 class ObjectStore native "*IDBObjectStore" {
662
663 /// @domName IDBObjectStore.autoIncrement; @docsEditable true
664 final bool autoIncrement;
665
666 /// @domName IDBObjectStore.indexNames; @docsEditable true
667 @Returns('_DomStringList') @Creates('_DomStringList')
668 final List<String> indexNames;
669
670 /// @domName IDBObjectStore.keyPath; @docsEditable true
671 final dynamic keyPath;
672
673 /// @domName IDBObjectStore.name; @docsEditable true
674 final String name;
675
676 /// @domName IDBObjectStore.transaction; @docsEditable true
677 final Transaction transaction;
678
679 /// @domName IDBObjectStore.add; @docsEditable true
680 Request add(/*any*/ value, [/*IDBKey*/ key]) {
681 if (?key) {
682 var value_1 = convertDartToNative_SerializedScriptValue(value);
683 var key_2 = _convertDartToNative_IDBKey(key);
684 return _add_1(value_1, key_2);
685 }
686 var value_3 = convertDartToNative_SerializedScriptValue(value);
687 return _add_2(value_3);
688 }
689 @JSName('add')
690 @Returns('Request') @Creates('Request') @_annotation_Creates_IDBKey
691 Request _add_1(value, key) native;
692 @JSName('add')
693 @Returns('Request') @Creates('Request') @_annotation_Creates_IDBKey
694 Request _add_2(value) native;
695
696 /// @domName IDBObjectStore.clear; @docsEditable true
697 Request clear() native;
698
699 /// @domName IDBObjectStore.count; @docsEditable true
700 Request count([key_OR_range]) {
701 if (!?key_OR_range) {
702 return _count_1();
703 }
704 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null))) {
705 return _count_2(key_OR_range);
706 }
707 if (?key_OR_range) {
708 var key_1 = _convertDartToNative_IDBKey(key_OR_range);
709 return _count_3(key_1);
710 }
711 throw new ArgumentError("Incorrect number or type of arguments");
712 }
713 @JSName('count')
714 Request _count_1() native;
715 @JSName('count')
716 Request _count_2(KeyRange range) native;
717 @JSName('count')
718 Request _count_3(key) native;
719
720 /// @domName IDBObjectStore.createIndex; @docsEditable true
721 Index createIndex(String name, keyPath, [Map options]) {
722 if ((?keyPath && (keyPath is List<String> || keyPath == null)) &&
723 !?options) {
724 List keyPath_1 = convertDartToNative_StringArray(keyPath);
725 return _createIndex_1(name, keyPath_1);
726 }
727 if ((?keyPath && (keyPath is List<String> || keyPath == null))) {
728 List keyPath_2 = convertDartToNative_StringArray(keyPath);
729 var options_3 = convertDartToNative_Dictionary(options);
730 return _createIndex_2(name, keyPath_2, options_3);
731 }
732 if ((?keyPath && (keyPath is String || keyPath == null)) &&
733 !?options) {
734 return _createIndex_3(name, keyPath);
735 }
736 if ((?keyPath && (keyPath is String || keyPath == null))) {
737 var options_4 = convertDartToNative_Dictionary(options);
738 return _createIndex_4(name, keyPath, options_4);
739 }
740 throw new ArgumentError("Incorrect number or type of arguments");
741 }
742 @JSName('createIndex')
743 Index _createIndex_1(name, List keyPath) native;
744 @JSName('createIndex')
745 Index _createIndex_2(name, List keyPath, options) native;
746 @JSName('createIndex')
747 Index _createIndex_3(name, String keyPath) native;
748 @JSName('createIndex')
749 Index _createIndex_4(name, String keyPath, options) native;
750
751 /// @domName IDBObjectStore.delete; @docsEditable true
752 Request delete(key_OR_keyRange) {
753 if ((?key_OR_keyRange && (key_OR_keyRange is KeyRange || key_OR_keyRange == null))) {
754 return _delete_1(key_OR_keyRange);
755 }
756 if (?key_OR_keyRange) {
757 var key_1 = _convertDartToNative_IDBKey(key_OR_keyRange);
758 return _delete_2(key_1);
759 }
760 throw new ArgumentError("Incorrect number or type of arguments");
761 }
762 @JSName('delete')
763 Request _delete_1(KeyRange keyRange) native;
764 @JSName('delete')
765 Request _delete_2(key) native;
766
767 /// @domName IDBObjectStore.deleteIndex; @docsEditable true
768 void deleteIndex(String name) native;
769
770 /// @domName IDBObjectStore.getObject; @docsEditable true
771 Request getObject(key) {
772 if ((?key && (key is KeyRange || key == null))) {
773 return _getObject_1(key);
774 }
775 if (?key) {
776 var key_1 = _convertDartToNative_IDBKey(key);
777 return _getObject_2(key_1);
778 }
779 throw new ArgumentError("Incorrect number or type of arguments");
780 }
781 @JSName('get')
782 @Returns('Request') @Creates('Request') @annotation_Creates_SerializedScriptVa lue
783 Request _getObject_1(KeyRange key) native;
784 @JSName('get')
785 @Returns('Request') @Creates('Request') @annotation_Creates_SerializedScriptVa lue
786 Request _getObject_2(key) native;
787
788 /// @domName IDBObjectStore.index; @docsEditable true
789 Index index(String name) native;
790
791 /// @domName IDBObjectStore.openCursor; @docsEditable true
792 Request openCursor([key_OR_range, String direction]) {
793 if (!?key_OR_range &&
794 !?direction) {
795 return _openCursor_1();
796 }
797 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null)) &&
798 !?direction) {
799 return _openCursor_2(key_OR_range);
800 }
801 if ((?key_OR_range && (key_OR_range is KeyRange || key_OR_range == null))) {
802 return _openCursor_3(key_OR_range, direction);
803 }
804 if (?key_OR_range &&
805 !?direction) {
806 var key_1 = _convertDartToNative_IDBKey(key_OR_range);
807 return _openCursor_4(key_1);
808 }
809 if (?key_OR_range) {
810 var key_2 = _convertDartToNative_IDBKey(key_OR_range);
811 return _openCursor_5(key_2, direction);
812 }
813 throw new ArgumentError("Incorrect number or type of arguments");
814 }
815 @JSName('openCursor')
816 @Returns('Request') @Creates('Request') @Creates('Cursor')
817 Request _openCursor_1() native;
818 @JSName('openCursor')
819 @Returns('Request') @Creates('Request') @Creates('Cursor')
820 Request _openCursor_2(KeyRange range) native;
821 @JSName('openCursor')
822 @Returns('Request') @Creates('Request') @Creates('Cursor')
823 Request _openCursor_3(KeyRange range, direction) native;
824 @JSName('openCursor')
825 @Returns('Request') @Creates('Request') @Creates('Cursor')
826 Request _openCursor_4(key) native;
827 @JSName('openCursor')
828 @Returns('Request') @Creates('Request') @Creates('Cursor')
829 Request _openCursor_5(key, direction) native;
830
831 /// @domName IDBObjectStore.put; @docsEditable true
832 Request put(/*any*/ value, [/*IDBKey*/ key]) {
833 if (?key) {
834 var value_1 = convertDartToNative_SerializedScriptValue(value);
835 var key_2 = _convertDartToNative_IDBKey(key);
836 return _put_1(value_1, key_2);
837 }
838 var value_3 = convertDartToNative_SerializedScriptValue(value);
839 return _put_2(value_3);
840 }
841 @JSName('put')
842 @Returns('Request') @Creates('Request') @_annotation_Creates_IDBKey
843 Request _put_1(value, key) native;
844 @JSName('put')
845 @Returns('Request') @Creates('Request') @_annotation_Creates_IDBKey
846 Request _put_2(value) native;
847 }
848 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
849 // for details. All rights reserved. Use of this source code is governed by a
850 // BSD-style license that can be found in the LICENSE file.
851
852
853 /// @domName IDBOpenDBRequest; @docsEditable true
854 class OpenDBRequest extends Request implements EventTarget native "*IDBOpenDBReq uest" {
855
856 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
857 OpenDBRequestEvents get on =>
858 new OpenDBRequestEvents(this);
859 }
860
861 class OpenDBRequestEvents extends RequestEvents {
862 OpenDBRequestEvents(EventTarget _ptr) : super(_ptr);
863
864 EventListenerList get blocked => this['blocked'];
865
866 EventListenerList get upgradeNeeded => this['upgradeneeded'];
867 }
868 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
869 // for details. All rights reserved. Use of this source code is governed by a
870 // BSD-style license that can be found in the LICENSE file.
871
872
873 /// @domName IDBRequest; @docsEditable true
874 class Request extends EventTarget native "*IDBRequest" {
875
876 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
877 RequestEvents get on =>
878 new RequestEvents(this);
879
880 /// @domName IDBRequest.error; @docsEditable true
881 final DomError error;
882
883 /// @domName IDBRequest.errorCode; @docsEditable true
884 final int errorCode;
885
886 /// @domName IDBRequest.readyState; @docsEditable true
887 final String readyState;
888
889 /// @domName IDBRequest.result; @docsEditable true
890 dynamic get result => _convertNativeToDart_IDBAny(this._result);
891 @JSName('result')
892 @Creates('Null')
893 final dynamic _result;
894
895 /// @domName IDBRequest.source; @docsEditable true
896 @Creates('Null')
897 final dynamic source;
898
899 /// @domName IDBRequest.transaction; @docsEditable true
900 final Transaction transaction;
901
902 /// @domName IDBRequest.webkitErrorMessage; @docsEditable true
903 final String webkitErrorMessage;
904
905 /// @domName IDBRequest.addEventListener; @docsEditable true
906 @JSName('addEventListener')
907 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native;
908
909 /// @domName IDBRequest.dispatchEvent; @docsEditable true
910 @JSName('dispatchEvent')
911 bool $dom_dispatchEvent(Event evt) native;
912
913 /// @domName IDBRequest.removeEventListener; @docsEditable true
914 @JSName('removeEventListener')
915 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native;
916 }
917
918 class RequestEvents extends Events {
919 RequestEvents(EventTarget _ptr) : super(_ptr);
920
921 EventListenerList get error => this['error'];
922
923 EventListenerList get success => this['success'];
924 }
925 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
926 // for details. All rights reserved. Use of this source code is governed by a
927 // BSD-style license that can be found in the LICENSE file.
928
929
930 /// @domName IDBTransaction; @docsEditable true
931 class Transaction extends EventTarget native "*IDBTransaction" {
932
933 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
934 TransactionEvents get on =>
935 new TransactionEvents(this);
936
937 static const int READ_ONLY = 0;
938
939 static const int READ_WRITE = 1;
940
941 static const int VERSION_CHANGE = 2;
942
943 /// @domName IDBTransaction.db; @docsEditable true
944 final Database db;
945
946 /// @domName IDBTransaction.error; @docsEditable true
947 final DomError error;
948
949 /// @domName IDBTransaction.mode; @docsEditable true
950 final String mode;
951
952 /// @domName IDBTransaction.abort; @docsEditable true
953 void abort() native;
954
955 /// @domName IDBTransaction.addEventListener; @docsEditable true
956 @JSName('addEventListener')
957 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native;
958
959 /// @domName IDBTransaction.dispatchEvent; @docsEditable true
960 @JSName('dispatchEvent')
961 bool $dom_dispatchEvent(Event evt) native;
962
963 /// @domName IDBTransaction.objectStore; @docsEditable true
964 ObjectStore objectStore(String name) native;
965
966 /// @domName IDBTransaction.removeEventListener; @docsEditable true
967 @JSName('removeEventListener')
968 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native;
969 }
970
971 class TransactionEvents extends Events {
972 TransactionEvents(EventTarget _ptr) : super(_ptr);
973
974 EventListenerList get abort => this['abort'];
975
976 EventListenerList get complete => this['complete'];
977
978 EventListenerList get error => this['error'];
979 }
980 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
981 // for details. All rights reserved. Use of this source code is governed by a
982 // BSD-style license that can be found in the LICENSE file.
983
984
985 /// @domName IDBVersionChangeEvent; @docsEditable true
986 class UpgradeNeededEvent extends Event native "*IDBVersionChangeEvent" {
987
988 /// @domName IDBVersionChangeEvent.newVersion; @docsEditable true
989 final int newVersion;
990
991 /// @domName IDBVersionChangeEvent.oldVersion; @docsEditable true
992 final int oldVersion;
993 }
994 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
995 // for details. All rights reserved. Use of this source code is governed by a
996 // BSD-style license that can be found in the LICENSE file.
997
998
999 /// @domName IDBVersionChangeEvent; @docsEditable true
1000 class VersionChangeEvent extends Event native "*IDBVersionChangeEvent" {
1001
1002 /// @domName IDBVersionChangeEvent.version; @docsEditable true
1003 final String version;
1004 }
1005 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1006 // for details. All rights reserved. Use of this source code is governed by a
1007 // BSD-style license that can be found in the LICENSE file.
1008
1009
1010 /// @domName IDBVersionChangeRequest; @docsEditable true
1011 class VersionChangeRequest extends Request implements EventTarget native "*IDBVe rsionChangeRequest" {
1012
1013 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
1014 VersionChangeRequestEvents get on =>
1015 new VersionChangeRequestEvents(this);
1016 }
1017
1018 class VersionChangeRequestEvents extends RequestEvents {
1019 VersionChangeRequestEvents(EventTarget _ptr) : super(_ptr);
1020
1021 EventListenerList get blocked => this['blocked'];
1022 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698