| OLD | NEW |
| 1 /** | 1 /** |
| 2 * A client-side key-value store with support for indexes. | 2 * A client-side key-value store with support for indexes. |
| 3 * | 3 * |
| 4 * Many browsers support IndexedDB—a web standard for | 4 * Many browsers support IndexedDB—a web standard for |
| 5 * an indexed database. | 5 * an indexed database. |
| 6 * By storing data on the client in an IndexedDB, | 6 * By storing data on the client in an IndexedDB, |
| 7 * a web app gets some advantages, such as faster performance and persistence. | 7 * a web app gets some advantages, such as faster performance and persistence. |
| 8 * To find out which browsers support IndexedDB, | 8 * To find out which browsers support IndexedDB, |
| 9 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) | 9 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) |
| 10 * | 10 * |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 if (key != null) { | 694 if (key != null) { |
| 695 if (range != null) { | 695 if (range != null) { |
| 696 throw new ArgumentError('Cannot specify both key and range.'); | 696 throw new ArgumentError('Cannot specify both key and range.'); |
| 697 } | 697 } |
| 698 key_OR_range = key; | 698 key_OR_range = key; |
| 699 } else { | 699 } else { |
| 700 key_OR_range = range; | 700 key_OR_range = range; |
| 701 } | 701 } |
| 702 var request; | 702 var request; |
| 703 if (direction == null) { | 703 if (direction == null) { |
| 704 request = _openCursor(key_OR_range); | 704 // FIXME: Passing in "next" should be unnecessary. |
| 705 request = _openCursor(key_OR_range, "next"); |
| 705 } else { | 706 } else { |
| 706 request = _openCursor(key_OR_range, direction); | 707 request = _openCursor(key_OR_range, direction); |
| 707 } | 708 } |
| 708 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 709 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 709 } | 710 } |
| 710 | 711 |
| 711 /** | 712 /** |
| 712 * Creates a stream of cursors over the records in this object store. | 713 * Creates a stream of cursors over the records in this object store. |
| 713 * | 714 * |
| 714 * See also: | 715 * See also: |
| 715 * | 716 * |
| 716 * * [ObjectStore.openCursor] | 717 * * [ObjectStore.openCursor] |
| 717 */ | 718 */ |
| 718 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, | 719 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, |
| 719 bool autoAdvance}) { | 720 bool autoAdvance}) { |
| 720 var key_OR_range = null; | 721 var key_OR_range = null; |
| 721 if (key != null) { | 722 if (key != null) { |
| 722 if (range != null) { | 723 if (range != null) { |
| 723 throw new ArgumentError('Cannot specify both key and range.'); | 724 throw new ArgumentError('Cannot specify both key and range.'); |
| 724 } | 725 } |
| 725 key_OR_range = key; | 726 key_OR_range = key; |
| 726 } else { | 727 } else { |
| 727 key_OR_range = range; | 728 key_OR_range = range; |
| 728 } | 729 } |
| 729 var request; | 730 var request; |
| 730 if (direction == null) { | 731 if (direction == null) { |
| 731 request = _openKeyCursor(key_OR_range); | 732 // FIXME: Passing in "next" should be unnecessary. |
| 733 request = _openKeyCursor(key_OR_range, "next"); |
| 732 } else { | 734 } else { |
| 733 request = _openKeyCursor(key_OR_range, direction); | 735 request = _openKeyCursor(key_OR_range, direction); |
| 734 } | 736 } |
| 735 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 737 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 736 } | 738 } |
| 737 | 739 |
| 738 // To suppress missing implicit constructor warnings. | 740 // To suppress missing implicit constructor warnings. |
| 739 factory Index._() { throw new UnsupportedError("Not supported"); } | 741 factory Index._() { throw new UnsupportedError("Not supported"); } |
| 740 | 742 |
| 741 @DomName('IDBIndex.keyPath') | 743 @DomName('IDBIndex.keyPath') |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 @annotation_Creates_SerializedScriptValue | 782 @annotation_Creates_SerializedScriptValue |
| 781 @Creates('ObjectStore') | 783 @Creates('ObjectStore') |
| 782 Request _getKey(Object key) native; | 784 Request _getKey(Object key) native; |
| 783 | 785 |
| 784 @JSName('openCursor') | 786 @JSName('openCursor') |
| 785 @DomName('IDBIndex.openCursor') | 787 @DomName('IDBIndex.openCursor') |
| 786 @DocsEditable() | 788 @DocsEditable() |
| 787 @Returns('Request') | 789 @Returns('Request') |
| 788 @Creates('Request') | 790 @Creates('Request') |
| 789 @Creates('Cursor') | 791 @Creates('Cursor') |
| 790 Request _openCursor(Object key, [String direction]) native; | 792 Request _openCursor(Object range, String direction) native; |
| 791 | 793 |
| 792 @JSName('openKeyCursor') | 794 @JSName('openKeyCursor') |
| 793 @DomName('IDBIndex.openKeyCursor') | 795 @DomName('IDBIndex.openKeyCursor') |
| 794 @DocsEditable() | 796 @DocsEditable() |
| 795 @Returns('Request') | 797 @Returns('Request') |
| 796 @Creates('Request') | 798 @Creates('Request') |
| 797 @Creates('Cursor') | 799 @Creates('Cursor') |
| 798 Request _openKeyCursor(Object key, [String direction]) native; | 800 Request _openKeyCursor(Object range, String direction) native; |
| 799 | 801 |
| 800 } | 802 } |
| 801 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 803 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 802 // for details. All rights reserved. Use of this source code is governed by a | 804 // for details. All rights reserved. Use of this source code is governed by a |
| 803 // BSD-style license that can be found in the LICENSE file. | 805 // BSD-style license that can be found in the LICENSE file. |
| 804 | 806 |
| 805 | 807 |
| 806 @DomName('IDBKeyRange') | 808 @DomName('IDBKeyRange') |
| 807 @Unstable() | 809 @Unstable() |
| 808 @Native("IDBKeyRange") | 810 @Native("IDBKeyRange") |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 @Creates('int|String|Null') | 1446 @Creates('int|String|Null') |
| 1445 @Returns('int|String|Null') | 1447 @Returns('int|String|Null') |
| 1446 final int newVersion; | 1448 final int newVersion; |
| 1447 | 1449 |
| 1448 @DomName('IDBVersionChangeEvent.oldVersion') | 1450 @DomName('IDBVersionChangeEvent.oldVersion') |
| 1449 @DocsEditable() | 1451 @DocsEditable() |
| 1450 @Creates('int|String|Null') | 1452 @Creates('int|String|Null') |
| 1451 @Returns('int|String|Null') | 1453 @Returns('int|String|Null') |
| 1452 final int oldVersion; | 1454 final int oldVersion; |
| 1453 } | 1455 } |
| OLD | NEW |