| OLD | NEW |
| 1 library dart.dom.indexed_db; | 1 library dart.dom.indexed_db; |
| 2 | 2 |
| 3 import 'dart:async'; | 3 import 'dart:async'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
| 6 import 'dart:nativewrappers'; | 6 import 'dart:nativewrappers'; |
| 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 8 // for details. All rights reserved. Use of this source code is governed by a | 8 // for details. All rights reserved. Use of this source code is governed by a |
| 9 // BSD-style license that can be found in the LICENSE file. | 9 // BSD-style license that can be found in the LICENSE file. |
| 10 | 10 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // for details. All rights reserved. Use of this source code is governed by a | 387 // for details. All rights reserved. Use of this source code is governed by a |
| 388 // BSD-style license that can be found in the LICENSE file. | 388 // BSD-style license that can be found in the LICENSE file. |
| 389 | 389 |
| 390 | 390 |
| 391 @DomName('IDBIndex') | 391 @DomName('IDBIndex') |
| 392 @Unstable() | 392 @Unstable() |
| 393 class Index extends NativeFieldWrapperClass1 { | 393 class Index extends NativeFieldWrapperClass1 { |
| 394 @DomName('IDBIndex.count') | 394 @DomName('IDBIndex.count') |
| 395 Future<int> count([key_OR_range]) { | 395 Future<int> count([key_OR_range]) { |
| 396 try { | 396 try { |
| 397 var request; | 397 var request = _count(key_OR_range); |
| 398 if (key_OR_range != null) { | |
| 399 request = _count(key_OR_range); | |
| 400 } else { | |
| 401 request = _count(); | |
| 402 } | |
| 403 return _completeRequest(request); | 398 return _completeRequest(request); |
| 404 } catch (e, stacktrace) { | 399 } catch (e, stacktrace) { |
| 405 return new Future.error(e, stacktrace); | 400 return new Future.error(e, stacktrace); |
| 406 } | 401 } |
| 407 } | 402 } |
| 408 | 403 |
| 409 @DomName('IDBIndex.get') | 404 @DomName('IDBIndex.get') |
| 410 Future get(key) { | 405 Future get(key) { |
| 411 try { | 406 try { |
| 412 var request = _get(key); | 407 var request = _get(key); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 439 bool autoAdvance}) { | 434 bool autoAdvance}) { |
| 440 var key_OR_range = null; | 435 var key_OR_range = null; |
| 441 if (key != null) { | 436 if (key != null) { |
| 442 if (range != null) { | 437 if (range != null) { |
| 443 throw new ArgumentError('Cannot specify both key and range.'); | 438 throw new ArgumentError('Cannot specify both key and range.'); |
| 444 } | 439 } |
| 445 key_OR_range = key; | 440 key_OR_range = key; |
| 446 } else { | 441 } else { |
| 447 key_OR_range = range; | 442 key_OR_range = range; |
| 448 } | 443 } |
| 449 var request; | 444 var request = _openCursor(key_OR_range, direction); |
| 450 if (direction == null) { | |
| 451 request = _openCursor(key_OR_range); | |
| 452 } else { | |
| 453 request = _openCursor(key_OR_range, direction); | |
| 454 } | |
| 455 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 445 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 456 } | 446 } |
| 457 | 447 |
| 458 /** | 448 /** |
| 459 * Creates a stream of cursors over the records in this object store. | 449 * Creates a stream of cursors over the records in this object store. |
| 460 * | 450 * |
| 461 * See also: | 451 * See also: |
| 462 * | 452 * |
| 463 * * [ObjectStore.openCursor] | 453 * * [ObjectStore.openCursor] |
| 464 */ | 454 */ |
| 465 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, | 455 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, |
| 466 bool autoAdvance}) { | 456 bool autoAdvance}) { |
| 467 var key_OR_range = null; | 457 var key_OR_range = null; |
| 468 if (key != null) { | 458 if (key != null) { |
| 469 if (range != null) { | 459 if (range != null) { |
| 470 throw new ArgumentError('Cannot specify both key and range.'); | 460 throw new ArgumentError('Cannot specify both key and range.'); |
| 471 } | 461 } |
| 472 key_OR_range = key; | 462 key_OR_range = key; |
| 473 } else { | 463 } else { |
| 474 key_OR_range = range; | 464 key_OR_range = range; |
| 475 } | 465 } |
| 476 var request; | 466 var request = _openKeyCursor(key_OR_range, direction); |
| 477 if (direction == null) { | |
| 478 request = _openKeyCursor(key_OR_range); | |
| 479 } else { | |
| 480 request = _openKeyCursor(key_OR_range, direction); | |
| 481 } | |
| 482 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 467 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 483 } | 468 } |
| 484 | 469 |
| 485 | 470 |
| 486 @DomName('IDBIndex.keyPath') | 471 @DomName('IDBIndex.keyPath') |
| 487 @DocsEditable() | 472 @DocsEditable() |
| 488 dynamic get keyPath native "IDBIndex_keyPath_Getter"; | 473 dynamic get keyPath native "IDBIndex_keyPath_Getter"; |
| 489 | 474 |
| 490 @DomName('IDBIndex.multiEntry') | 475 @DomName('IDBIndex.multiEntry') |
| 491 @DocsEditable() | 476 @DocsEditable() |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 | 1036 |
| 1052 // WARNING: Do not edit - generated code. | 1037 // WARNING: Do not edit - generated code. |
| 1053 | 1038 |
| 1054 | 1039 |
| 1055 @DocsEditable() | 1040 @DocsEditable() |
| 1056 @DomName('IDBAny') | 1041 @DomName('IDBAny') |
| 1057 @deprecated // nonstandard | 1042 @deprecated // nonstandard |
| 1058 abstract class _IDBAny extends NativeFieldWrapperClass1 { | 1043 abstract class _IDBAny extends NativeFieldWrapperClass1 { |
| 1059 | 1044 |
| 1060 } | 1045 } |
| OLD | NEW |