| 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:_js_helper' show Creates, Returns, JSName, Null; | 6 import 'dart:_js_helper' show Creates, Returns, JSName, Null; |
| 7 import 'dart:_foreign_helper' show JS; | 7 import 'dart:_foreign_helper' show JS; |
| 8 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 8 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 9 // for details. All rights reserved. Use of this source code is governed by a | 9 // for details. All rights reserved. Use of this source code is governed by a |
| 10 // BSD-style license that can be found in the LICENSE file. | 10 // BSD-style license that can be found in the LICENSE file. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 @DomName('IDBCursor.value') | 150 @DomName('IDBCursor.value') |
| 151 Future update(value) { | 151 Future update(value) { |
| 152 try { | 152 try { |
| 153 return _completeRequest($dom_update(value)); | 153 return _completeRequest($dom_update(value)); |
| 154 } catch (e, stacktrace) { | 154 } catch (e, stacktrace) { |
| 155 return new Future.immediateError(e, stacktrace); | 155 return new Future.immediateError(e, stacktrace); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 | 159 |
| 160 @DomName('IDBCursor.direction') | 160 @DomName('IDBCursor.direction') |
| 161 @DocsEditable | 161 @DocsEditable |
| 162 final String direction; | 162 final String direction; |
| 163 | 163 |
| 164 @DomName('IDBCursor.key') | 164 @DomName('IDBCursor.key') |
| 165 @DocsEditable | 165 @DocsEditable |
| 166 @_annotation_Creates_IDBKey | 166 @_annotation_Creates_IDBKey |
| 167 @_annotation_Returns_IDBKey | 167 @_annotation_Returns_IDBKey |
| 168 final Object key; | 168 final Object key; |
| 169 | 169 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 } | 565 } |
| 566 var request; | 566 var request; |
| 567 if (direction == null) { | 567 if (direction == null) { |
| 568 request = $dom_openKeyCursor(key_OR_range); | 568 request = $dom_openKeyCursor(key_OR_range); |
| 569 } else { | 569 } else { |
| 570 request = $dom_openKeyCursor(key_OR_range, direction); | 570 request = $dom_openKeyCursor(key_OR_range, direction); |
| 571 } | 571 } |
| 572 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 572 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 573 } | 573 } |
| 574 | 574 |
| 575 | 575 |
| 576 @DomName('IDBIndex.keyPath') | 576 @DomName('IDBIndex.keyPath') |
| 577 @DocsEditable | 577 @DocsEditable |
| 578 final dynamic keyPath; | 578 final dynamic keyPath; |
| 579 | 579 |
| 580 @DomName('IDBIndex.multiEntry') | 580 @DomName('IDBIndex.multiEntry') |
| 581 @DocsEditable | 581 @DocsEditable |
| 582 final bool multiEntry; | 582 final bool multiEntry; |
| 583 | 583 |
| 584 @DomName('IDBIndex.name') | 584 @DomName('IDBIndex.name') |
| 585 @DocsEditable | 585 @DocsEditable |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 */ | 998 */ |
| 999 static Stream<Cursor> _cursorStreamFromResult(Request request, | 999 static Stream<Cursor> _cursorStreamFromResult(Request request, |
| 1000 bool autoAdvance) { | 1000 bool autoAdvance) { |
| 1001 // TODO: need to guarantee that the controller provides the values | 1001 // TODO: need to guarantee that the controller provides the values |
| 1002 // immediately as waiting until the next tick will cause the transaction to | 1002 // immediately as waiting until the next tick will cause the transaction to |
| 1003 // close. | 1003 // close. |
| 1004 var controller = new StreamController(); | 1004 var controller = new StreamController(); |
| 1005 | 1005 |
| 1006 request.onError.listen((e) { | 1006 request.onError.listen((e) { |
| 1007 //TODO: Report stacktrace once issue 4061 is resolved. | 1007 //TODO: Report stacktrace once issue 4061 is resolved. |
| 1008 controller.signalError(e); | 1008 controller.addError(e); |
| 1009 }); | 1009 }); |
| 1010 | 1010 |
| 1011 request.onSuccess.listen((e) { | 1011 request.onSuccess.listen((e) { |
| 1012 Cursor cursor = request.result; | 1012 Cursor cursor = request.result; |
| 1013 if (cursor == null) { | 1013 if (cursor == null) { |
| 1014 controller.close(); | 1014 controller.close(); |
| 1015 } else { | 1015 } else { |
| 1016 controller.add(cursor); | 1016 controller.add(cursor); |
| 1017 if (autoAdvance == true) { | 1017 if (autoAdvance == true) { |
| 1018 cursor.next(); | 1018 cursor.next(); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 } | 1238 } |
| 1239 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1239 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1240 // for details. All rights reserved. Use of this source code is governed by a | 1240 // for details. All rights reserved. Use of this source code is governed by a |
| 1241 // BSD-style license that can be found in the LICENSE file. | 1241 // BSD-style license that can be found in the LICENSE file. |
| 1242 | 1242 |
| 1243 | 1243 |
| 1244 @DocsEditable | 1244 @DocsEditable |
| 1245 @DomName('IDBAny') | 1245 @DomName('IDBAny') |
| 1246 class _IDBAny native "*IDBAny" { | 1246 class _IDBAny native "*IDBAny" { |
| 1247 } | 1247 } |
| OLD | NEW |