| 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:typed_data'; | 6 import 'dart:typed_data'; |
| 7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; | 7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; |
| 8 import 'dart:_foreign_helper' show JS; | 8 import 'dart:_foreign_helper' show JS; |
| 9 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 9 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 10 // for details. All rights reserved. Use of this source code is governed by a | 10 // for details. All rights reserved. Use of this source code is governed by a |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add DateTime. | 132 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add DateTime. |
| 133 const _annotation_Creates_IDBKey = const Creates(_idbKey); | 133 const _annotation_Creates_IDBKey = const Creates(_idbKey); |
| 134 const _annotation_Returns_IDBKey = const Returns(_idbKey); | 134 const _annotation_Returns_IDBKey = const Returns(_idbKey); |
| 135 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 135 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 136 // for details. All rights reserved. Use of this source code is governed by a | 136 // for details. All rights reserved. Use of this source code is governed by a |
| 137 // BSD-style license that can be found in the LICENSE file. | 137 // BSD-style license that can be found in the LICENSE file. |
| 138 | 138 |
| 139 | 139 |
| 140 @DomName('IDBCursor') | 140 @DomName('IDBCursor') |
| 141 @Unstable |
| 141 class Cursor native "IDBCursor" { | 142 class Cursor native "IDBCursor" { |
| 142 @DomName('IDBCursor.delete') | 143 @DomName('IDBCursor.delete') |
| 143 Future delete() { | 144 Future delete() { |
| 144 try { | 145 try { |
| 145 return _completeRequest($dom_delete()); | 146 return _completeRequest($dom_delete()); |
| 146 } catch (e, stacktrace) { | 147 } catch (e, stacktrace) { |
| 147 return new Future.error(e, stacktrace); | 148 return new Future.error(e, stacktrace); |
| 148 } | 149 } |
| 149 } | 150 } |
| 150 | 151 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 Request _$dom_update_1(value) native; | 203 Request _$dom_update_1(value) native; |
| 203 | 204 |
| 204 } | 205 } |
| 205 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 206 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 206 // for details. All rights reserved. Use of this source code is governed by a | 207 // for details. All rights reserved. Use of this source code is governed by a |
| 207 // BSD-style license that can be found in the LICENSE file. | 208 // BSD-style license that can be found in the LICENSE file. |
| 208 | 209 |
| 209 | 210 |
| 210 @DocsEditable | 211 @DocsEditable |
| 211 @DomName('IDBCursorWithValue') | 212 @DomName('IDBCursorWithValue') |
| 213 @Unstable |
| 212 class CursorWithValue extends Cursor native "IDBCursorWithValue" { | 214 class CursorWithValue extends Cursor native "IDBCursorWithValue" { |
| 213 | 215 |
| 214 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); | 216 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); |
| 215 @JSName('value') | 217 @JSName('value') |
| 216 @DomName('IDBCursorWithValue.value') | 218 @DomName('IDBCursorWithValue.value') |
| 217 @DocsEditable | 219 @DocsEditable |
| 218 @annotation_Creates_SerializedScriptValue | 220 @annotation_Creates_SerializedScriptValue |
| 219 @annotation_Returns_SerializedScriptValue | 221 @annotation_Returns_SerializedScriptValue |
| 220 final dynamic _get_value; | 222 final dynamic _get_value; |
| 221 } | 223 } |
| 222 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 224 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 223 // for details. All rights reserved. Use of this source code is governed by a | 225 // for details. All rights reserved. Use of this source code is governed by a |
| 224 // BSD-style license that can be found in the LICENSE file. | 226 // BSD-style license that can be found in the LICENSE file. |
| 225 | 227 |
| 226 | 228 |
| 227 @DocsEditable | 229 @DocsEditable |
| 228 @DomName('IDBDatabase') | 230 @DomName('IDBDatabase') |
| 229 @SupportedBrowser(SupportedBrowser.CHROME) | 231 @SupportedBrowser(SupportedBrowser.CHROME) |
| 230 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') | 232 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') |
| 231 @SupportedBrowser(SupportedBrowser.IE, '10') | 233 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 232 @Experimental | 234 @Experimental |
| 235 @Unstable |
| 233 class Database extends EventTarget native "IDBDatabase" { | 236 class Database extends EventTarget native "IDBDatabase" { |
| 234 @DomName('IDBDatabase.createObjectStore') | 237 @DomName('IDBDatabase.createObjectStore') |
| 235 @DocsEditable | 238 @DocsEditable |
| 236 ObjectStore createObjectStore(String name, | 239 ObjectStore createObjectStore(String name, |
| 237 {String keyPath, bool autoIncrement}) { | 240 {String keyPath, bool autoIncrement}) { |
| 238 var options = {}; | 241 var options = {}; |
| 239 if (keyPath != null) { | 242 if (keyPath != null) { |
| 240 options['keyPath'] = keyPath; | 243 options['keyPath'] = keyPath; |
| 241 } | 244 } |
| 242 if (autoIncrement != null) { | 245 if (autoIncrement != null) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 348 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 346 // for details. All rights reserved. Use of this source code is governed by a | 349 // for details. All rights reserved. Use of this source code is governed by a |
| 347 // BSD-style license that can be found in the LICENSE file. | 350 // BSD-style license that can be found in the LICENSE file. |
| 348 | 351 |
| 349 | 352 |
| 350 @DomName('IDBFactory') | 353 @DomName('IDBFactory') |
| 351 @SupportedBrowser(SupportedBrowser.CHROME) | 354 @SupportedBrowser(SupportedBrowser.CHROME) |
| 352 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') | 355 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') |
| 353 @SupportedBrowser(SupportedBrowser.IE, '10') | 356 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 354 @Experimental | 357 @Experimental |
| 358 @Unstable |
| 355 class IdbFactory native "IDBFactory" { | 359 class IdbFactory native "IDBFactory" { |
| 356 /** | 360 /** |
| 357 * Checks to see if Indexed DB is supported on the current platform. | 361 * Checks to see if Indexed DB is supported on the current platform. |
| 358 */ | 362 */ |
| 359 static bool get supported { | 363 static bool get supported { |
| 360 return JS('bool', | 364 return JS('bool', |
| 361 '!!(window.indexedDB || ' | 365 '!!(window.indexedDB || ' |
| 362 'window.webkitIndexedDB || ' | 366 'window.webkitIndexedDB || ' |
| 363 'window.mozIndexedDB)'); | 367 'window.mozIndexedDB)'); |
| 364 } | 368 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 completer.completeError(e); | 478 completer.completeError(e); |
| 475 }); | 479 }); |
| 476 return completer.future; | 480 return completer.future; |
| 477 } | 481 } |
| 478 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 482 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 479 // for details. All rights reserved. Use of this source code is governed by a | 483 // for details. All rights reserved. Use of this source code is governed by a |
| 480 // BSD-style license that can be found in the LICENSE file. | 484 // BSD-style license that can be found in the LICENSE file. |
| 481 | 485 |
| 482 | 486 |
| 483 @DomName('IDBIndex') | 487 @DomName('IDBIndex') |
| 488 @Unstable |
| 484 class Index native "IDBIndex" { | 489 class Index native "IDBIndex" { |
| 485 @DomName('IDBIndex.count') | 490 @DomName('IDBIndex.count') |
| 486 Future<int> count([key_OR_range]) { | 491 Future<int> count([key_OR_range]) { |
| 487 try { | 492 try { |
| 488 var request; | 493 var request; |
| 489 if (key_OR_range != null) { | 494 if (key_OR_range != null) { |
| 490 request = $dom_count(key_OR_range); | 495 request = $dom_count(key_OR_range); |
| 491 } else { | 496 } else { |
| 492 request = $dom_count(); | 497 request = $dom_count(); |
| 493 } | 498 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 @Creates('Cursor') | 637 @Creates('Cursor') |
| 633 Request $dom_openKeyCursor([key_OR_range, String direction]) native; | 638 Request $dom_openKeyCursor([key_OR_range, String direction]) native; |
| 634 | 639 |
| 635 } | 640 } |
| 636 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 641 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 637 // for details. All rights reserved. Use of this source code is governed by a | 642 // for details. All rights reserved. Use of this source code is governed by a |
| 638 // BSD-style license that can be found in the LICENSE file. | 643 // BSD-style license that can be found in the LICENSE file. |
| 639 | 644 |
| 640 | 645 |
| 641 @DomName('IDBKeyRange') | 646 @DomName('IDBKeyRange') |
| 647 @Unstable |
| 642 class KeyRange native "IDBKeyRange" { | 648 class KeyRange native "IDBKeyRange" { |
| 643 @DomName('IDBKeyRange.only') | 649 @DomName('IDBKeyRange.only') |
| 644 factory KeyRange.only(/*Key*/ value) => | 650 factory KeyRange.only(/*Key*/ value) => |
| 645 _KeyRangeFactoryProvider.createKeyRange_only(value); | 651 _KeyRangeFactoryProvider.createKeyRange_only(value); |
| 646 | 652 |
| 647 @DomName('IDBKeyRange.lowerBound') | 653 @DomName('IDBKeyRange.lowerBound') |
| 648 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => | 654 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => |
| 649 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); | 655 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); |
| 650 | 656 |
| 651 @DomName('IDBKeyRange.upperBound') | 657 @DomName('IDBKeyRange.upperBound') |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 @DocsEditable | 701 @DocsEditable |
| 696 static KeyRange upperBound_(Object bound, [bool open]) native; | 702 static KeyRange upperBound_(Object bound, [bool open]) native; |
| 697 | 703 |
| 698 } | 704 } |
| 699 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 705 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 700 // for details. All rights reserved. Use of this source code is governed by a | 706 // for details. All rights reserved. Use of this source code is governed by a |
| 701 // BSD-style license that can be found in the LICENSE file. | 707 // BSD-style license that can be found in the LICENSE file. |
| 702 | 708 |
| 703 | 709 |
| 704 @DomName('IDBObjectStore') | 710 @DomName('IDBObjectStore') |
| 711 @Unstable |
| 705 class ObjectStore native "IDBObjectStore" { | 712 class ObjectStore native "IDBObjectStore" { |
| 706 | 713 |
| 707 @DomName('IDBObjectStore.add') | 714 @DomName('IDBObjectStore.add') |
| 708 Future add(value, [key]) { | 715 Future add(value, [key]) { |
| 709 try { | 716 try { |
| 710 var request; | 717 var request; |
| 711 if (key != null) { | 718 if (key != null) { |
| 712 request = $dom_add(value, key); | 719 request = $dom_add(value, key); |
| 713 } else { | 720 } else { |
| 714 request = $dom_add(value); | 721 request = $dom_add(value); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 return controller.stream; | 1030 return controller.stream; |
| 1024 } | 1031 } |
| 1025 } | 1032 } |
| 1026 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1033 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1027 // for details. All rights reserved. Use of this source code is governed by a | 1034 // for details. All rights reserved. Use of this source code is governed by a |
| 1028 // BSD-style license that can be found in the LICENSE file. | 1035 // BSD-style license that can be found in the LICENSE file. |
| 1029 | 1036 |
| 1030 | 1037 |
| 1031 @DocsEditable | 1038 @DocsEditable |
| 1032 @DomName('IDBOpenDBRequest') | 1039 @DomName('IDBOpenDBRequest') |
| 1040 @Unstable |
| 1033 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ
est" { | 1041 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ
est" { |
| 1034 | 1042 |
| 1035 @DomName('IDBOpenDBRequest.blockedEvent') | 1043 @DomName('IDBOpenDBRequest.blockedEvent') |
| 1036 @DocsEditable | 1044 @DocsEditable |
| 1037 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); | 1045 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); |
| 1038 | 1046 |
| 1039 @DomName('IDBOpenDBRequest.upgradeneededEvent') | 1047 @DomName('IDBOpenDBRequest.upgradeneededEvent') |
| 1040 @DocsEditable | 1048 @DocsEditable |
| 1041 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); | 1049 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); |
| 1042 | 1050 |
| 1043 @DomName('IDBOpenDBRequest.onblocked') | 1051 @DomName('IDBOpenDBRequest.onblocked') |
| 1044 @DocsEditable | 1052 @DocsEditable |
| 1045 Stream<Event> get onBlocked => blockedEvent.forTarget(this); | 1053 Stream<Event> get onBlocked => blockedEvent.forTarget(this); |
| 1046 | 1054 |
| 1047 @DomName('IDBOpenDBRequest.onupgradeneeded') | 1055 @DomName('IDBOpenDBRequest.onupgradeneeded') |
| 1048 @DocsEditable | 1056 @DocsEditable |
| 1049 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); | 1057 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); |
| 1050 } | 1058 } |
| 1051 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1059 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1052 // for details. All rights reserved. Use of this source code is governed by a | 1060 // for details. All rights reserved. Use of this source code is governed by a |
| 1053 // BSD-style license that can be found in the LICENSE file. | 1061 // BSD-style license that can be found in the LICENSE file. |
| 1054 | 1062 |
| 1055 | 1063 |
| 1056 @DocsEditable | 1064 @DocsEditable |
| 1057 @DomName('IDBRequest') | 1065 @DomName('IDBRequest') |
| 1066 @Unstable |
| 1058 class Request extends EventTarget native "IDBRequest" { | 1067 class Request extends EventTarget native "IDBRequest" { |
| 1059 | 1068 |
| 1060 @DomName('IDBRequest.errorEvent') | 1069 @DomName('IDBRequest.errorEvent') |
| 1061 @DocsEditable | 1070 @DocsEditable |
| 1062 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1071 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
| 1063 | 1072 |
| 1064 @DomName('IDBRequest.successEvent') | 1073 @DomName('IDBRequest.successEvent') |
| 1065 @DocsEditable | 1074 @DocsEditable |
| 1066 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); | 1075 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); |
| 1067 | 1076 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 @DomName('IDBRequest.onsuccess') | 1127 @DomName('IDBRequest.onsuccess') |
| 1119 @DocsEditable | 1128 @DocsEditable |
| 1120 Stream<Event> get onSuccess => successEvent.forTarget(this); | 1129 Stream<Event> get onSuccess => successEvent.forTarget(this); |
| 1121 } | 1130 } |
| 1122 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1131 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 1123 // for details. All rights reserved. Use of this source code is governed by a | 1132 // for details. All rights reserved. Use of this source code is governed by a |
| 1124 // BSD-style license that can be found in the LICENSE file. | 1133 // BSD-style license that can be found in the LICENSE file. |
| 1125 | 1134 |
| 1126 | 1135 |
| 1127 @DomName('IDBTransaction') | 1136 @DomName('IDBTransaction') |
| 1137 @Unstable |
| 1128 class Transaction extends EventTarget native "IDBTransaction" { | 1138 class Transaction extends EventTarget native "IDBTransaction" { |
| 1129 | 1139 |
| 1130 /** | 1140 /** |
| 1131 * Provides a Future which will be completed once the transaction has | 1141 * Provides a Future which will be completed once the transaction has |
| 1132 * completed. | 1142 * completed. |
| 1133 * | 1143 * |
| 1134 * The future will error if an error occurrs on the transaction or if the | 1144 * The future will error if an error occurrs on the transaction or if the |
| 1135 * transaction is aborted. | 1145 * transaction is aborted. |
| 1136 */ | 1146 */ |
| 1137 Future<Database> get completed { | 1147 Future<Database> get completed { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 Stream<Event> get onError => errorEvent.forTarget(this); | 1230 Stream<Event> get onError => errorEvent.forTarget(this); |
| 1221 | 1231 |
| 1222 } | 1232 } |
| 1223 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1233 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1224 // for details. All rights reserved. Use of this source code is governed by a | 1234 // for details. All rights reserved. Use of this source code is governed by a |
| 1225 // BSD-style license that can be found in the LICENSE file. | 1235 // BSD-style license that can be found in the LICENSE file. |
| 1226 | 1236 |
| 1227 | 1237 |
| 1228 @DocsEditable | 1238 @DocsEditable |
| 1229 @DomName('IDBVersionChangeEvent') | 1239 @DomName('IDBVersionChangeEvent') |
| 1240 @Unstable |
| 1230 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" { | 1241 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" { |
| 1231 | 1242 |
| 1232 @DomName('IDBVersionChangeEvent.newVersion') | 1243 @DomName('IDBVersionChangeEvent.newVersion') |
| 1233 @DocsEditable | 1244 @DocsEditable |
| 1234 final dynamic newVersion; | 1245 final dynamic newVersion; |
| 1235 | 1246 |
| 1236 @DomName('IDBVersionChangeEvent.oldVersion') | 1247 @DomName('IDBVersionChangeEvent.oldVersion') |
| 1237 @DocsEditable | 1248 @DocsEditable |
| 1238 final dynamic oldVersion; | 1249 final dynamic oldVersion; |
| 1239 } | 1250 } |
| 1240 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1251 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1241 // for details. All rights reserved. Use of this source code is governed by a | 1252 // for details. All rights reserved. Use of this source code is governed by a |
| 1242 // BSD-style license that can be found in the LICENSE file. | 1253 // BSD-style license that can be found in the LICENSE file. |
| 1243 | 1254 |
| 1244 | 1255 |
| 1245 @DocsEditable | 1256 @DocsEditable |
| 1246 @DomName('IDBAny') | 1257 @DomName('IDBAny') |
| 1258 @deprecated // nonstandard |
| 1247 abstract class _IDBAny native "IDBAny" { | 1259 abstract class _IDBAny native "IDBAny" { |
| 1248 } | 1260 } |
| OLD | NEW |