| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 @DomName('IDBCursor.value') | 152 @DomName('IDBCursor.value') |
| 153 Future update(value) { | 153 Future update(value) { |
| 154 try { | 154 try { |
| 155 return _completeRequest($dom_update(value)); | 155 return _completeRequest($dom_update(value)); |
| 156 } catch (e, stacktrace) { | 156 } catch (e, stacktrace) { |
| 157 return new Future.error(e, stacktrace); | 157 return new Future.error(e, stacktrace); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 // To suppress missing implicit constructor warnings. | 161 |
| 162 factory Cursor._() { throw new UnsupportedError("Not supported"); } | |
| 163 | |
| 164 @DomName('IDBCursor.direction') | 162 @DomName('IDBCursor.direction') |
| 165 @DocsEditable | 163 @DocsEditable |
| 166 final String direction; | 164 final String direction; |
| 167 | 165 |
| 168 @DomName('IDBCursor.key') | 166 @DomName('IDBCursor.key') |
| 169 @DocsEditable | 167 @DocsEditable |
| 170 @_annotation_Creates_IDBKey | 168 @_annotation_Creates_IDBKey |
| 171 @_annotation_Returns_IDBKey | 169 @_annotation_Returns_IDBKey |
| 172 final Object key; | 170 final Object key; |
| 173 | 171 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 209 } |
| 212 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 210 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 213 // for details. All rights reserved. Use of this source code is governed by a | 211 // for details. All rights reserved. Use of this source code is governed by a |
| 214 // BSD-style license that can be found in the LICENSE file. | 212 // BSD-style license that can be found in the LICENSE file. |
| 215 | 213 |
| 216 | 214 |
| 217 @DocsEditable | 215 @DocsEditable |
| 218 @DomName('IDBCursorWithValue') | 216 @DomName('IDBCursorWithValue') |
| 219 @Unstable | 217 @Unstable |
| 220 class CursorWithValue extends Cursor native "IDBCursorWithValue" { | 218 class CursorWithValue extends Cursor native "IDBCursorWithValue" { |
| 221 // To suppress missing implicit constructor warnings. | |
| 222 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); } | |
| 223 | 219 |
| 224 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); | 220 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); |
| 225 @JSName('value') | 221 @JSName('value') |
| 226 @DomName('IDBCursorWithValue.value') | 222 @DomName('IDBCursorWithValue.value') |
| 227 @DocsEditable | 223 @DocsEditable |
| 228 @annotation_Creates_SerializedScriptValue | 224 @annotation_Creates_SerializedScriptValue |
| 229 @annotation_Returns_SerializedScriptValue | 225 @annotation_Returns_SerializedScriptValue |
| 230 final dynamic _get_value; | 226 final dynamic _get_value; |
| 231 } | 227 } |
| 232 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 228 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 263 |
| 268 // Try and create a transaction with a string mode. Browsers that expect a | 264 // Try and create a transaction with a string mode. Browsers that expect a |
| 269 // numeric mode tend to convert the string into a number. This fails | 265 // numeric mode tend to convert the string into a number. This fails |
| 270 // silently, resulting in zero ('readonly'). | 266 // silently, resulting in zero ('readonly'). |
| 271 return _transaction(storeName_OR_storeNames, mode); | 267 return _transaction(storeName_OR_storeNames, mode); |
| 272 } | 268 } |
| 273 | 269 |
| 274 @JSName('transaction') | 270 @JSName('transaction') |
| 275 Transaction _transaction(stores, mode) native; | 271 Transaction _transaction(stores, mode) native; |
| 276 | 272 |
| 277 // To suppress missing implicit constructor warnings. | |
| 278 factory Database._() { throw new UnsupportedError("Not supported"); } | |
| 279 | 273 |
| 280 @DomName('IDBDatabase.abortEvent') | 274 @DomName('IDBDatabase.abortEvent') |
| 281 @DocsEditable | 275 @DocsEditable |
| 282 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 276 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); |
| 283 | 277 |
| 284 @DomName('IDBDatabase.errorEvent') | 278 @DomName('IDBDatabase.errorEvent') |
| 285 @DocsEditable | 279 @DocsEditable |
| 286 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 280 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
| 287 | 281 |
| 288 @DomName('IDBDatabase.versionchangeEvent') | 282 @DomName('IDBDatabase.versionchangeEvent') |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } | 437 } |
| 444 | 438 |
| 445 /** | 439 /** |
| 446 * Checks to see if getDatabaseNames is supported by the current platform. | 440 * Checks to see if getDatabaseNames is supported by the current platform. |
| 447 */ | 441 */ |
| 448 bool get supportsDatabaseNames { | 442 bool get supportsDatabaseNames { |
| 449 return supported && JS('bool', | 443 return supported && JS('bool', |
| 450 '!!(#.getDatabaseNames || #.webkitGetDatabaseNames)', this, this); | 444 '!!(#.getDatabaseNames || #.webkitGetDatabaseNames)', this, this); |
| 451 } | 445 } |
| 452 | 446 |
| 453 // To suppress missing implicit constructor warnings. | |
| 454 factory IdbFactory._() { throw new UnsupportedError("Not supported"); } | |
| 455 | 447 |
| 456 @DomName('IDBFactory.cmp') | 448 @DomName('IDBFactory.cmp') |
| 457 @DocsEditable | 449 @DocsEditable |
| 458 int cmp(Object first, Object second) native; | 450 int cmp(Object first, Object second) native; |
| 459 | 451 |
| 460 @JSName('deleteDatabase') | 452 @JSName('deleteDatabase') |
| 461 @DomName('IDBFactory.deleteDatabase') | 453 @DomName('IDBFactory.deleteDatabase') |
| 462 @DocsEditable | 454 @DocsEditable |
| 463 OpenDBRequest $dom_deleteDatabase(String name) native; | 455 OpenDBRequest $dom_deleteDatabase(String name) native; |
| 464 | 456 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 } | 584 } |
| 593 var request; | 585 var request; |
| 594 if (direction == null) { | 586 if (direction == null) { |
| 595 request = $dom_openKeyCursor(key_OR_range); | 587 request = $dom_openKeyCursor(key_OR_range); |
| 596 } else { | 588 } else { |
| 597 request = $dom_openKeyCursor(key_OR_range, direction); | 589 request = $dom_openKeyCursor(key_OR_range, direction); |
| 598 } | 590 } |
| 599 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 591 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 600 } | 592 } |
| 601 | 593 |
| 602 // To suppress missing implicit constructor warnings. | 594 |
| 603 factory Index._() { throw new UnsupportedError("Not supported"); } | |
| 604 | |
| 605 @DomName('IDBIndex.keyPath') | 595 @DomName('IDBIndex.keyPath') |
| 606 @DocsEditable | 596 @DocsEditable |
| 607 @annotation_Creates_SerializedScriptValue | 597 @annotation_Creates_SerializedScriptValue |
| 608 final dynamic keyPath; | 598 final dynamic keyPath; |
| 609 | 599 |
| 610 @DomName('IDBIndex.multiEntry') | 600 @DomName('IDBIndex.multiEntry') |
| 611 @DocsEditable | 601 @DocsEditable |
| 612 final bool multiEntry; | 602 final bool multiEntry; |
| 613 | 603 |
| 614 @DomName('IDBIndex.name') | 604 @DomName('IDBIndex.name') |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 @DomName('IDBKeyRange.upperBound') | 671 @DomName('IDBKeyRange.upperBound') |
| 682 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => | 672 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => |
| 683 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); | 673 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); |
| 684 | 674 |
| 685 @DomName('KeyRange.bound') | 675 @DomName('KeyRange.bound') |
| 686 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, | 676 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, |
| 687 [bool lowerOpen = false, bool upperOpen = false]) => | 677 [bool lowerOpen = false, bool upperOpen = false]) => |
| 688 _KeyRangeFactoryProvider.createKeyRange_bound( | 678 _KeyRangeFactoryProvider.createKeyRange_bound( |
| 689 lower, upper, lowerOpen, upperOpen); | 679 lower, upper, lowerOpen, upperOpen); |
| 690 | 680 |
| 691 // To suppress missing implicit constructor warnings. | |
| 692 factory KeyRange._() { throw new UnsupportedError("Not supported"); } | |
| 693 | 681 |
| 694 @DomName('IDBKeyRange.lower') | 682 @DomName('IDBKeyRange.lower') |
| 695 @DocsEditable | 683 @DocsEditable |
| 696 @annotation_Creates_SerializedScriptValue | 684 @annotation_Creates_SerializedScriptValue |
| 697 final Object lower; | 685 final Object lower; |
| 698 | 686 |
| 699 @DomName('IDBKeyRange.lowerOpen') | 687 @DomName('IDBKeyRange.lowerOpen') |
| 700 @DocsEditable | 688 @DocsEditable |
| 701 final bool lowerOpen; | 689 final bool lowerOpen; |
| 702 | 690 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 if (unique != null) { | 851 if (unique != null) { |
| 864 options['unique'] = unique; | 852 options['unique'] = unique; |
| 865 } | 853 } |
| 866 if (multiEntry != null) { | 854 if (multiEntry != null) { |
| 867 options['multiEntry'] = multiEntry; | 855 options['multiEntry'] = multiEntry; |
| 868 } | 856 } |
| 869 | 857 |
| 870 return $dom_createIndex(name, keyPath, options); | 858 return $dom_createIndex(name, keyPath, options); |
| 871 } | 859 } |
| 872 | 860 |
| 873 // To suppress missing implicit constructor warnings. | |
| 874 factory ObjectStore._() { throw new UnsupportedError("Not supported"); } | |
| 875 | 861 |
| 876 @DomName('IDBObjectStore.autoIncrement') | 862 @DomName('IDBObjectStore.autoIncrement') |
| 877 @DocsEditable | 863 @DocsEditable |
| 878 final bool autoIncrement; | 864 final bool autoIncrement; |
| 879 | 865 |
| 880 @DomName('IDBObjectStore.indexNames') | 866 @DomName('IDBObjectStore.indexNames') |
| 881 @DocsEditable | 867 @DocsEditable |
| 882 @Returns('DomStringList') | 868 @Returns('DomStringList') |
| 883 @Creates('DomStringList') | 869 @Creates('DomStringList') |
| 884 final List<String> indexNames; | 870 final List<String> indexNames; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 } | 1049 } |
| 1064 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1050 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1065 // for details. All rights reserved. Use of this source code is governed by a | 1051 // for details. All rights reserved. Use of this source code is governed by a |
| 1066 // BSD-style license that can be found in the LICENSE file. | 1052 // BSD-style license that can be found in the LICENSE file. |
| 1067 | 1053 |
| 1068 | 1054 |
| 1069 @DocsEditable | 1055 @DocsEditable |
| 1070 @DomName('IDBOpenDBRequest') | 1056 @DomName('IDBOpenDBRequest') |
| 1071 @Unstable | 1057 @Unstable |
| 1072 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ
est" { | 1058 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ
est" { |
| 1073 // To suppress missing implicit constructor warnings. | |
| 1074 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); } | |
| 1075 | 1059 |
| 1076 @DomName('IDBOpenDBRequest.blockedEvent') | 1060 @DomName('IDBOpenDBRequest.blockedEvent') |
| 1077 @DocsEditable | 1061 @DocsEditable |
| 1078 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); | 1062 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); |
| 1079 | 1063 |
| 1080 @DomName('IDBOpenDBRequest.upgradeneededEvent') | 1064 @DomName('IDBOpenDBRequest.upgradeneededEvent') |
| 1081 @DocsEditable | 1065 @DocsEditable |
| 1082 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); | 1066 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); |
| 1083 | 1067 |
| 1084 @DomName('IDBOpenDBRequest.onblocked') | 1068 @DomName('IDBOpenDBRequest.onblocked') |
| 1085 @DocsEditable | 1069 @DocsEditable |
| 1086 Stream<Event> get onBlocked => blockedEvent.forTarget(this); | 1070 Stream<Event> get onBlocked => blockedEvent.forTarget(this); |
| 1087 | 1071 |
| 1088 @DomName('IDBOpenDBRequest.onupgradeneeded') | 1072 @DomName('IDBOpenDBRequest.onupgradeneeded') |
| 1089 @DocsEditable | 1073 @DocsEditable |
| 1090 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); | 1074 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); |
| 1091 } | 1075 } |
| 1092 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1076 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1093 // for details. All rights reserved. Use of this source code is governed by a | 1077 // for details. All rights reserved. Use of this source code is governed by a |
| 1094 // BSD-style license that can be found in the LICENSE file. | 1078 // BSD-style license that can be found in the LICENSE file. |
| 1095 | 1079 |
| 1096 | 1080 |
| 1097 @DocsEditable | 1081 @DocsEditable |
| 1098 @DomName('IDBRequest') | 1082 @DomName('IDBRequest') |
| 1099 @Unstable | 1083 @Unstable |
| 1100 class Request extends EventTarget native "IDBRequest" { | 1084 class Request extends EventTarget native "IDBRequest" { |
| 1101 // To suppress missing implicit constructor warnings. | |
| 1102 factory Request._() { throw new UnsupportedError("Not supported"); } | |
| 1103 | 1085 |
| 1104 @DomName('IDBRequest.errorEvent') | 1086 @DomName('IDBRequest.errorEvent') |
| 1105 @DocsEditable | 1087 @DocsEditable |
| 1106 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1088 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
| 1107 | 1089 |
| 1108 @DomName('IDBRequest.successEvent') | 1090 @DomName('IDBRequest.successEvent') |
| 1109 @DocsEditable | 1091 @DocsEditable |
| 1110 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); | 1092 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); |
| 1111 | 1093 |
| 1112 @DomName('IDBRequest.error') | 1094 @DomName('IDBRequest.error') |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 completer.completeError(e); | 1172 completer.completeError(e); |
| 1191 }); | 1173 }); |
| 1192 | 1174 |
| 1193 this.onAbort.first.then((e) { | 1175 this.onAbort.first.then((e) { |
| 1194 completer.completeError(e); | 1176 completer.completeError(e); |
| 1195 }); | 1177 }); |
| 1196 | 1178 |
| 1197 return completer.future; | 1179 return completer.future; |
| 1198 } | 1180 } |
| 1199 | 1181 |
| 1200 // To suppress missing implicit constructor warnings. | |
| 1201 factory Transaction._() { throw new UnsupportedError("Not supported"); } | |
| 1202 | 1182 |
| 1203 @DomName('IDBTransaction.abortEvent') | 1183 @DomName('IDBTransaction.abortEvent') |
| 1204 @DocsEditable | 1184 @DocsEditable |
| 1205 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 1185 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); |
| 1206 | 1186 |
| 1207 @DomName('IDBTransaction.completeEvent') | 1187 @DomName('IDBTransaction.completeEvent') |
| 1208 @DocsEditable | 1188 @DocsEditable |
| 1209 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); | 1189 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); |
| 1210 | 1190 |
| 1211 @DomName('IDBTransaction.errorEvent') | 1191 @DomName('IDBTransaction.errorEvent') |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 } | 1249 } |
| 1270 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1250 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1271 // for details. All rights reserved. Use of this source code is governed by a | 1251 // for details. All rights reserved. Use of this source code is governed by a |
| 1272 // BSD-style license that can be found in the LICENSE file. | 1252 // BSD-style license that can be found in the LICENSE file. |
| 1273 | 1253 |
| 1274 | 1254 |
| 1275 @DocsEditable | 1255 @DocsEditable |
| 1276 @DomName('IDBVersionChangeEvent') | 1256 @DomName('IDBVersionChangeEvent') |
| 1277 @Unstable | 1257 @Unstable |
| 1278 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" { | 1258 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" { |
| 1279 // To suppress missing implicit constructor warnings. | |
| 1280 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported");
} | |
| 1281 | 1259 |
| 1282 @DomName('IDBVersionChangeEvent.newVersion') | 1260 @DomName('IDBVersionChangeEvent.newVersion') |
| 1283 @DocsEditable | 1261 @DocsEditable |
| 1284 @Creates('int|String|Null') | 1262 @Creates('int|String|Null') |
| 1285 @Returns('int|String|Null') | 1263 @Returns('int|String|Null') |
| 1286 final dynamic newVersion; | 1264 final dynamic newVersion; |
| 1287 | 1265 |
| 1288 @DomName('IDBVersionChangeEvent.oldVersion') | 1266 @DomName('IDBVersionChangeEvent.oldVersion') |
| 1289 @DocsEditable | 1267 @DocsEditable |
| 1290 @Creates('int|String|Null') | 1268 @Creates('int|String|Null') |
| 1291 @Returns('int|String|Null') | 1269 @Returns('int|String|Null') |
| 1292 final dynamic oldVersion; | 1270 final dynamic oldVersion; |
| 1293 } | 1271 } |
| 1294 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1272 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1295 // for details. All rights reserved. Use of this source code is governed by a | 1273 // for details. All rights reserved. Use of this source code is governed by a |
| 1296 // BSD-style license that can be found in the LICENSE file. | 1274 // BSD-style license that can be found in the LICENSE file. |
| 1297 | 1275 |
| 1298 | 1276 |
| 1299 @DocsEditable | 1277 @DocsEditable |
| 1300 @DomName('IDBAny') | 1278 @DomName('IDBAny') |
| 1301 @deprecated // nonstandard | 1279 @deprecated // nonstandard |
| 1302 abstract class _IDBAny native "IDBAny" { | 1280 abstract class _IDBAny native "IDBAny" { |
| 1303 // To suppress missing implicit constructor warnings. | |
| 1304 factory _IDBAny._() { throw new UnsupportedError("Not supported"); } | |
| 1305 } | 1281 } |
| OLD | NEW |