| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 static KeyRange createKeyRange_upperBound( | 27 static KeyRange createKeyRange_upperBound( |
| 28 /*IDBKey*/ bound, [bool open = false]) => | 28 /*IDBKey*/ bound, [bool open = false]) => |
| 29 KeyRange.upperBound_(bound, open); | 29 KeyRange.upperBound_(bound, open); |
| 30 | 30 |
| 31 static KeyRange createKeyRange_bound( | 31 static KeyRange createKeyRange_bound( |
| 32 /*IDBKey*/ lower, /*IDBKey*/ upper, | 32 /*IDBKey*/ lower, /*IDBKey*/ upper, |
| 33 [bool lowerOpen = false, bool upperOpen = false]) => | 33 [bool lowerOpen = false, bool upperOpen = false]) => |
| 34 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); | 34 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); |
| 35 } | 35 } |
| 36 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 36 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 37 // for details. All rights reserved. Use of this source code is governed by a | 37 // for details. All rights reserved. Use of this source code is governed by a |
| 38 // BSD-style license that can be found in the LICENSE file. | 38 // BSD-style license that can be found in the LICENSE file. |
| 39 | 39 |
| 40 // WARNING: Do not edit - generated code. | |
| 41 | 40 |
| 42 | |
| 43 @DocsEditable | |
| 44 @DomName('IDBCursor') | 41 @DomName('IDBCursor') |
| 45 class Cursor extends NativeFieldWrapperClass1 { | 42 class Cursor extends NativeFieldWrapperClass1 { |
| 46 Cursor.internal(); | 43 @DomName('IDBCursor.delete') |
| 44 Future delete() { |
| 45 try { |
| 46 return _completeRequest($dom_delete()); |
| 47 } catch (e, stacktrace) { |
| 48 return new Future.immediateError(e, stacktrace); |
| 49 } |
| 50 } |
| 51 |
| 52 @DomName('IDBCursor.value') |
| 53 Future update(value) { |
| 54 try { |
| 55 return _completeRequest($dom_update(value)); |
| 56 } catch (e, stacktrace) { |
| 57 return new Future.immediateError(e, stacktrace); |
| 58 } |
| 59 } |
| 60 |
| 61 Cursor.internal(); |
| 47 | 62 |
| 48 @DomName('IDBCursor.direction') | 63 @DomName('IDBCursor.direction') |
| 49 @DocsEditable | 64 @DocsEditable |
| 50 String get direction native "IDBCursor_direction_Getter"; | 65 String get direction native "IDBCursor_direction_Getter"; |
| 51 | 66 |
| 52 @DomName('IDBCursor.key') | 67 @DomName('IDBCursor.key') |
| 53 @DocsEditable | 68 @DocsEditable |
| 54 Object get key native "IDBCursor_key_Getter"; | 69 Object get key native "IDBCursor_key_Getter"; |
| 55 | 70 |
| 56 @DomName('IDBCursor.primaryKey') | 71 @DomName('IDBCursor.primaryKey') |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 @DomName('IDBCursor._continue_1') | 92 @DomName('IDBCursor._continue_1') |
| 78 @DocsEditable | 93 @DocsEditable |
| 79 void _continue_1(key) native "IDBCursor__continue_1_Callback"; | 94 void _continue_1(key) native "IDBCursor__continue_1_Callback"; |
| 80 | 95 |
| 81 @DomName('IDBCursor._continue_2') | 96 @DomName('IDBCursor._continue_2') |
| 82 @DocsEditable | 97 @DocsEditable |
| 83 void _continue_2() native "IDBCursor__continue_2_Callback"; | 98 void _continue_2() native "IDBCursor__continue_2_Callback"; |
| 84 | 99 |
| 85 @DomName('IDBCursor.delete') | 100 @DomName('IDBCursor.delete') |
| 86 @DocsEditable | 101 @DocsEditable |
| 87 Request delete() native "IDBCursor_delete_Callback"; | 102 Request $dom_delete() native "IDBCursor_delete_Callback"; |
| 88 | 103 |
| 89 @DomName('IDBCursor.update') | 104 @DomName('IDBCursor.update') |
| 90 @DocsEditable | 105 @DocsEditable |
| 91 Request update(Object value) native "IDBCursor_update_Callback"; | 106 Request $dom_update(Object value) native "IDBCursor_update_Callback"; |
| 92 | 107 |
| 93 } | 108 } |
| 94 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 109 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 95 // for details. All rights reserved. Use of this source code is governed by a | 110 // for details. All rights reserved. Use of this source code is governed by a |
| 96 // BSD-style license that can be found in the LICENSE file. | 111 // BSD-style license that can be found in the LICENSE file. |
| 97 | 112 |
| 98 // WARNING: Do not edit - generated code. | 113 // WARNING: Do not edit - generated code. |
| 99 | 114 |
| 100 | 115 |
| 101 @DocsEditable | 116 @DocsEditable |
| 102 @DomName('IDBCursorWithValue') | 117 @DomName('IDBCursorWithValue') |
| 103 class CursorWithValue extends Cursor { | 118 class CursorWithValue extends Cursor { |
| 104 CursorWithValue.internal() : super.internal(); | 119 CursorWithValue.internal() : super.internal(); |
| 105 | 120 |
| 106 @DomName('IDBCursorWithValue.value') | 121 @DomName('IDBCursorWithValue.value') |
| 107 @DocsEditable | 122 @DocsEditable |
| 108 Object get value native "IDBCursorWithValue_value_Getter"; | 123 Object get value native "IDBCursorWithValue_value_Getter"; |
| 109 | 124 |
| 110 } | 125 } |
| 111 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 126 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 112 // for details. All rights reserved. Use of this source code is governed by a | 127 // for details. All rights reserved. Use of this source code is governed by a |
| 113 // BSD-style license that can be found in the LICENSE file. | 128 // BSD-style license that can be found in the LICENSE file. |
| 114 | 129 |
| 115 // WARNING: Do not edit - generated code. | |
| 116 | |
| 117 | 130 |
| 118 @DocsEditable | 131 @DocsEditable |
| 119 @DomName('IDBDatabase') | 132 @DomName('IDBDatabase') |
| 120 @SupportedBrowser(SupportedBrowser.CHROME) | 133 @SupportedBrowser(SupportedBrowser.CHROME) |
| 121 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') | 134 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') |
| 122 @SupportedBrowser(SupportedBrowser.IE, '10') | 135 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 123 @Experimental | 136 @Experimental |
| 124 class Database extends EventTarget { | 137 class Database extends EventTarget { |
| 138 @DomName('IDBDatabase.createObjectStore') |
| 139 @DocsEditable |
| 140 ObjectStore createObjectStore(String name, |
| 141 {String keyPath, bool autoIncrement}) { |
| 142 var options = {}; |
| 143 if (keyPath != null) { |
| 144 options['keyPath'] = keyPath; |
| 145 } |
| 146 if (autoIncrement != null) { |
| 147 options['autoIncrement'] = autoIncrement; |
| 148 } |
| 149 |
| 150 return $dom_createObjectStore(name, options); |
| 151 } |
| 152 |
| 153 |
| 125 Database.internal() : super.internal(); | 154 Database.internal() : super.internal(); |
| 126 | 155 |
| 127 @DomName('IDBDatabase.abortEvent') | 156 @DomName('IDBDatabase.abortEvent') |
| 128 @DocsEditable | 157 @DocsEditable |
| 129 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 158 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); |
| 130 | 159 |
| 131 @DomName('IDBDatabase.errorEvent') | 160 @DomName('IDBDatabase.errorEvent') |
| 132 @DocsEditable | 161 @DocsEditable |
| 133 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 162 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
| 134 | 163 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 151 @DomName('IDBDatabase.addEventListener') | 180 @DomName('IDBDatabase.addEventListener') |
| 152 @DocsEditable | 181 @DocsEditable |
| 153 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu
re]) native "IDBDatabase_addEventListener_Callback"; | 182 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu
re]) native "IDBDatabase_addEventListener_Callback"; |
| 154 | 183 |
| 155 @DomName('IDBDatabase.close') | 184 @DomName('IDBDatabase.close') |
| 156 @DocsEditable | 185 @DocsEditable |
| 157 void close() native "IDBDatabase_close_Callback"; | 186 void close() native "IDBDatabase_close_Callback"; |
| 158 | 187 |
| 159 @DomName('IDBDatabase.createObjectStore') | 188 @DomName('IDBDatabase.createObjectStore') |
| 160 @DocsEditable | 189 @DocsEditable |
| 161 ObjectStore createObjectStore(String name, [Map options]) native "IDBDatabase_
createObjectStore_Callback"; | 190 ObjectStore $dom_createObjectStore(String name, [Map options]) native "IDBData
base_createObjectStore_Callback"; |
| 162 | 191 |
| 163 @DomName('IDBDatabase.deleteObjectStore') | 192 @DomName('IDBDatabase.deleteObjectStore') |
| 164 @DocsEditable | 193 @DocsEditable |
| 165 void deleteObjectStore(String name) native "IDBDatabase_deleteObjectStore_Call
back"; | 194 void deleteObjectStore(String name) native "IDBDatabase_deleteObjectStore_Call
back"; |
| 166 | 195 |
| 167 @DomName('IDBDatabase.dispatchEvent') | 196 @DomName('IDBDatabase.dispatchEvent') |
| 168 @DocsEditable | 197 @DocsEditable |
| 169 bool dispatchEvent(Event evt) native "IDBDatabase_dispatchEvent_Callback"; | 198 bool dispatchEvent(Event evt) native "IDBDatabase_dispatchEvent_Callback"; |
| 170 | 199 |
| 171 @DomName('IDBDatabase.removeEventListener') | 200 @DomName('IDBDatabase.removeEventListener') |
| (...skipping 29 matching lines...) Expand all Loading... |
| 201 @DocsEditable | 230 @DocsEditable |
| 202 Stream<Event> get onAbort => abortEvent.forTarget(this); | 231 Stream<Event> get onAbort => abortEvent.forTarget(this); |
| 203 | 232 |
| 204 @DomName('IDBDatabase.onerror') | 233 @DomName('IDBDatabase.onerror') |
| 205 @DocsEditable | 234 @DocsEditable |
| 206 Stream<Event> get onError => errorEvent.forTarget(this); | 235 Stream<Event> get onError => errorEvent.forTarget(this); |
| 207 | 236 |
| 208 @DomName('IDBDatabase.onversionchange') | 237 @DomName('IDBDatabase.onversionchange') |
| 209 @DocsEditable | 238 @DocsEditable |
| 210 Stream<VersionChangeEvent> get onVersionChange => versionChangeEvent.forTarget
(this); | 239 Stream<VersionChangeEvent> get onVersionChange => versionChangeEvent.forTarget
(this); |
| 211 | |
| 212 } | 240 } |
| 213 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 241 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 214 // for details. All rights reserved. Use of this source code is governed by a | 242 // for details. All rights reserved. Use of this source code is governed by a |
| 215 // BSD-style license that can be found in the LICENSE file. | 243 // BSD-style license that can be found in the LICENSE file. |
| 216 | 244 |
| 217 | 245 |
| 218 @DomName('IDBFactory') | 246 @DomName('IDBFactory') |
| 219 @SupportedBrowser(SupportedBrowser.CHROME) | 247 @SupportedBrowser(SupportedBrowser.CHROME) |
| 220 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') | 248 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') |
| 221 @SupportedBrowser(SupportedBrowser.IE, '10') | 249 @SupportedBrowser(SupportedBrowser.IE, '10') |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 292 |
| 265 if (onBlocked != null) { | 293 if (onBlocked != null) { |
| 266 request.onBlocked.listen(onBlocked); | 294 request.onBlocked.listen(onBlocked); |
| 267 } | 295 } |
| 268 return _completeRequest(request); | 296 return _completeRequest(request); |
| 269 } catch (e, stacktrace) { | 297 } catch (e, stacktrace) { |
| 270 return new Future.immediateError(e, stacktrace); | 298 return new Future.immediateError(e, stacktrace); |
| 271 } | 299 } |
| 272 } | 300 } |
| 273 | 301 |
| 302 @DomName('IDBFactory.getDatabaseNames') |
| 303 @SupportedBrowser(SupportedBrowser.CHROME) |
| 304 @Experimental |
| 305 Future<List<String>> getDatabaseNames() { |
| 306 try { |
| 307 var request = $dom_webkitGetDatabaseNames(); |
| 308 |
| 309 return _completeRequest(request); |
| 310 } catch (e, stacktrace) { |
| 311 return new Future.immediateError(e, stacktrace); |
| 312 } |
| 313 } |
| 314 |
| 315 /** |
| 316 * Checks to see if getDatabaseNames is supported by the current platform. |
| 317 */ |
| 318 bool get supportsDatabaseNames { |
| 319 return true; |
| 320 } |
| 321 |
| 274 IdbFactory.internal(); | 322 IdbFactory.internal(); |
| 275 | 323 |
| 276 @DomName('IDBFactory.cmp') | 324 @DomName('IDBFactory.cmp') |
| 277 @DocsEditable | 325 @DocsEditable |
| 278 int cmp(Object first, Object second) native "IDBFactory_cmp_Callback"; | 326 int cmp(Object first, Object second) native "IDBFactory_cmp_Callback"; |
| 279 | 327 |
| 280 @DomName('IDBFactory.deleteDatabase') | 328 @DomName('IDBFactory.deleteDatabase') |
| 281 @DocsEditable | 329 @DocsEditable |
| 282 OpenDBRequest $dom_deleteDatabase(String name) native "IDBFactory_deleteDataba
se_Callback"; | 330 OpenDBRequest $dom_deleteDatabase(String name) native "IDBFactory_deleteDataba
se_Callback"; |
| 283 | 331 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 294 | 342 |
| 295 @DomName('IDBFactory._open_2') | 343 @DomName('IDBFactory._open_2') |
| 296 @DocsEditable | 344 @DocsEditable |
| 297 OpenDBRequest _open_2(name) native "IDBFactory__open_2_Callback"; | 345 OpenDBRequest _open_2(name) native "IDBFactory__open_2_Callback"; |
| 298 | 346 |
| 299 @DomName('IDBFactory.webkitGetDatabaseNames') | 347 @DomName('IDBFactory.webkitGetDatabaseNames') |
| 300 @DocsEditable | 348 @DocsEditable |
| 301 @SupportedBrowser(SupportedBrowser.CHROME) | 349 @SupportedBrowser(SupportedBrowser.CHROME) |
| 302 @SupportedBrowser(SupportedBrowser.SAFARI) | 350 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 303 @Experimental | 351 @Experimental |
| 304 Request getDatabaseNames() native "IDBFactory_webkitGetDatabaseNames_Callback"
; | 352 Request $dom_webkitGetDatabaseNames() native "IDBFactory_webkitGetDatabaseName
s_Callback"; |
| 305 | 353 |
| 306 } | 354 } |
| 307 | 355 |
| 308 | 356 |
| 309 /** | 357 /** |
| 310 * Ties a request to a completer, so the completer is completed when it succeeds | 358 * Ties a request to a completer, so the completer is completed when it succeeds |
| 311 * and errors out when the request errors. | 359 * and errors out when the request errors. |
| 312 */ | 360 */ |
| 313 Future _completeRequest(Request request) { | 361 Future _completeRequest(Request request) { |
| 314 var completer = new Completer(); | 362 var completer = new Completer(); |
| 315 // TODO: make sure that completer.complete is synchronous as transactions | 363 // TODO: make sure that completer.complete is synchronous as transactions |
| 316 // may be committed if the result is not processed immediately. | 364 // may be committed if the result is not processed immediately. |
| 317 request.onSuccess.listen((e) { | 365 request.onSuccess.listen((e) { |
| 318 completer.complete(request.result); | 366 completer.complete(request.result); |
| 319 }); | 367 }); |
| 320 request.onError.listen((e) { | 368 request.onError.listen((e) { |
| 321 completer.completeError(e); | 369 completer.completeError(e); |
| 322 }); | 370 }); |
| 323 return completer.future; | 371 return completer.future; |
| 324 } | 372 } |
| 325 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 373 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 326 // for details. All rights reserved. Use of this source code is governed by a | 374 // for details. All rights reserved. Use of this source code is governed by a |
| 327 // BSD-style license that can be found in the LICENSE file. | 375 // BSD-style license that can be found in the LICENSE file. |
| 328 | 376 |
| 329 // WARNING: Do not edit - generated code. | |
| 330 | 377 |
| 331 | |
| 332 @DocsEditable | |
| 333 @DomName('IDBIndex') | 378 @DomName('IDBIndex') |
| 334 class Index extends NativeFieldWrapperClass1 { | 379 class Index extends NativeFieldWrapperClass1 { |
| 335 Index.internal(); | 380 @DomName('IDBIndex.count') |
| 381 Future<int> count([key_OR_range]) { |
| 382 try { |
| 383 var request; |
| 384 if (key_OR_range != null) { |
| 385 request = $dom_count(key_OR_range); |
| 386 } else { |
| 387 request = $dom_count(); |
| 388 } |
| 389 return _completeRequest(request); |
| 390 } catch (e, stacktrace) { |
| 391 return new Future.immediateError(e, stacktrace); |
| 392 } |
| 393 } |
| 394 |
| 395 @DomName('IDBIndex.get') |
| 396 Future get(key) { |
| 397 try { |
| 398 var request = $dom_get(key); |
| 399 |
| 400 return _completeRequest(request); |
| 401 } catch (e, stacktrace) { |
| 402 return new Future.immediateError(e, stacktrace); |
| 403 } |
| 404 } |
| 405 |
| 406 @DomName('IDBIndex.getKey') |
| 407 Future getKey(key) { |
| 408 try { |
| 409 var request = $dom_getKey(key); |
| 410 |
| 411 return _completeRequest(request); |
| 412 } catch (e, stacktrace) { |
| 413 return new Future.immediateError(e, stacktrace); |
| 414 } |
| 415 } |
| 416 |
| 417 /** |
| 418 * Creates a stream of cursors over the records in this object store. |
| 419 * |
| 420 * See also: |
| 421 * |
| 422 * * [ObjectStore.openCursor] |
| 423 */ |
| 424 Stream<CursorWithValue> openCursor({key, KeyRange range, String direction, |
| 425 bool autoAdvance}) { |
| 426 var key_OR_range = null; |
| 427 if (key != null) { |
| 428 if (range != null) { |
| 429 throw new ArgumentError('Cannot specify both key and range.'); |
| 430 } |
| 431 key_OR_range = key; |
| 432 } else { |
| 433 key_OR_range = range; |
| 434 } |
| 435 var request; |
| 436 if (direction == null) { |
| 437 request = $dom_openCursor(key_OR_range); |
| 438 } else { |
| 439 request = $dom_openCursor(key_OR_range, direction); |
| 440 } |
| 441 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 442 } |
| 443 |
| 444 /** |
| 445 * Creates a stream of cursors over the records in this object store. |
| 446 * |
| 447 * See also: |
| 448 * |
| 449 * * [ObjectStore.openCursor] |
| 450 */ |
| 451 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, |
| 452 bool autoAdvance}) { |
| 453 var key_OR_range = null; |
| 454 if (key != null) { |
| 455 if (range != null) { |
| 456 throw new ArgumentError('Cannot specify both key and range.'); |
| 457 } |
| 458 key_OR_range = key; |
| 459 } else { |
| 460 key_OR_range = range; |
| 461 } |
| 462 var request; |
| 463 if (direction == null) { |
| 464 request = $dom_openKeyCursor(key_OR_range); |
| 465 } else { |
| 466 request = $dom_openKeyCursor(key_OR_range, direction); |
| 467 } |
| 468 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 469 } |
| 470 |
| 471 Index.internal(); |
| 336 | 472 |
| 337 @DomName('IDBIndex.keyPath') | 473 @DomName('IDBIndex.keyPath') |
| 338 @DocsEditable | 474 @DocsEditable |
| 339 dynamic get keyPath native "IDBIndex_keyPath_Getter"; | 475 dynamic get keyPath native "IDBIndex_keyPath_Getter"; |
| 340 | 476 |
| 341 @DomName('IDBIndex.multiEntry') | 477 @DomName('IDBIndex.multiEntry') |
| 342 @DocsEditable | 478 @DocsEditable |
| 343 bool get multiEntry native "IDBIndex_multiEntry_Getter"; | 479 bool get multiEntry native "IDBIndex_multiEntry_Getter"; |
| 344 | 480 |
| 345 @DomName('IDBIndex.name') | 481 @DomName('IDBIndex.name') |
| 346 @DocsEditable | 482 @DocsEditable |
| 347 String get name native "IDBIndex_name_Getter"; | 483 String get name native "IDBIndex_name_Getter"; |
| 348 | 484 |
| 349 @DomName('IDBIndex.objectStore') | 485 @DomName('IDBIndex.objectStore') |
| 350 @DocsEditable | 486 @DocsEditable |
| 351 ObjectStore get objectStore native "IDBIndex_objectStore_Getter"; | 487 ObjectStore get objectStore native "IDBIndex_objectStore_Getter"; |
| 352 | 488 |
| 353 @DomName('IDBIndex.unique') | 489 @DomName('IDBIndex.unique') |
| 354 @DocsEditable | 490 @DocsEditable |
| 355 bool get unique native "IDBIndex_unique_Getter"; | 491 bool get unique native "IDBIndex_unique_Getter"; |
| 356 | 492 |
| 357 Request count([key_OR_range]) { | 493 Request $dom_count([key_OR_range]) { |
| 358 if (!?key_OR_range) { | 494 if (!?key_OR_range) { |
| 359 return _count_1(); | 495 return _count_1(); |
| 360 } | 496 } |
| 361 if ((key_OR_range is KeyRange || key_OR_range == null)) { | 497 if ((key_OR_range is KeyRange || key_OR_range == null)) { |
| 362 return _count_2(key_OR_range); | 498 return _count_2(key_OR_range); |
| 363 } | 499 } |
| 364 if (?key_OR_range) { | 500 if (?key_OR_range) { |
| 365 return _count_3(key_OR_range); | 501 return _count_3(key_OR_range); |
| 366 } | 502 } |
| 367 throw new ArgumentError("Incorrect number or type of arguments"); | 503 throw new ArgumentError("Incorrect number or type of arguments"); |
| 368 } | 504 } |
| 369 | 505 |
| 370 @DomName('IDBIndex._count_1') | 506 @DomName('IDBIndex._count_1') |
| 371 @DocsEditable | 507 @DocsEditable |
| 372 Request _count_1() native "IDBIndex__count_1_Callback"; | 508 Request _count_1() native "IDBIndex__count_1_Callback"; |
| 373 | 509 |
| 374 @DomName('IDBIndex._count_2') | 510 @DomName('IDBIndex._count_2') |
| 375 @DocsEditable | 511 @DocsEditable |
| 376 Request _count_2(key_OR_range) native "IDBIndex__count_2_Callback"; | 512 Request _count_2(key_OR_range) native "IDBIndex__count_2_Callback"; |
| 377 | 513 |
| 378 @DomName('IDBIndex._count_3') | 514 @DomName('IDBIndex._count_3') |
| 379 @DocsEditable | 515 @DocsEditable |
| 380 Request _count_3(key_OR_range) native "IDBIndex__count_3_Callback"; | 516 Request _count_3(key_OR_range) native "IDBIndex__count_3_Callback"; |
| 381 | 517 |
| 382 Request get(key) { | 518 Request $dom_get(key) { |
| 383 if ((key is KeyRange || key == null)) { | 519 if ((key is KeyRange || key == null)) { |
| 384 return _get_1(key); | 520 return _get_1(key); |
| 385 } | 521 } |
| 386 if (?key) { | 522 if (?key) { |
| 387 return _get_2(key); | 523 return _get_2(key); |
| 388 } | 524 } |
| 389 throw new ArgumentError("Incorrect number or type of arguments"); | 525 throw new ArgumentError("Incorrect number or type of arguments"); |
| 390 } | 526 } |
| 391 | 527 |
| 392 @DomName('IDBIndex._get_1') | 528 @DomName('IDBIndex._get_1') |
| 393 @DocsEditable | 529 @DocsEditable |
| 394 Request _get_1(key) native "IDBIndex__get_1_Callback"; | 530 Request _get_1(key) native "IDBIndex__get_1_Callback"; |
| 395 | 531 |
| 396 @DomName('IDBIndex._get_2') | 532 @DomName('IDBIndex._get_2') |
| 397 @DocsEditable | 533 @DocsEditable |
| 398 Request _get_2(key) native "IDBIndex__get_2_Callback"; | 534 Request _get_2(key) native "IDBIndex__get_2_Callback"; |
| 399 | 535 |
| 400 Request getKey(key) { | 536 Request $dom_getKey(key) { |
| 401 if ((key is KeyRange || key == null)) { | 537 if ((key is KeyRange || key == null)) { |
| 402 return _getKey_1(key); | 538 return _getKey_1(key); |
| 403 } | 539 } |
| 404 if (?key) { | 540 if (?key) { |
| 405 return _getKey_2(key); | 541 return _getKey_2(key); |
| 406 } | 542 } |
| 407 throw new ArgumentError("Incorrect number or type of arguments"); | 543 throw new ArgumentError("Incorrect number or type of arguments"); |
| 408 } | 544 } |
| 409 | 545 |
| 410 @DomName('IDBIndex._getKey_1') | 546 @DomName('IDBIndex._getKey_1') |
| 411 @DocsEditable | 547 @DocsEditable |
| 412 Request _getKey_1(key) native "IDBIndex__getKey_1_Callback"; | 548 Request _getKey_1(key) native "IDBIndex__getKey_1_Callback"; |
| 413 | 549 |
| 414 @DomName('IDBIndex._getKey_2') | 550 @DomName('IDBIndex._getKey_2') |
| 415 @DocsEditable | 551 @DocsEditable |
| 416 Request _getKey_2(key) native "IDBIndex__getKey_2_Callback"; | 552 Request _getKey_2(key) native "IDBIndex__getKey_2_Callback"; |
| 417 | 553 |
| 418 Request openCursor([key_OR_range, String direction]) { | 554 Request $dom_openCursor([key_OR_range, String direction]) { |
| 419 if (!?key_OR_range && !?direction) { | 555 if (!?key_OR_range && !?direction) { |
| 420 return _openCursor_1(); | 556 return _openCursor_1(); |
| 421 } | 557 } |
| 422 if ((key_OR_range is KeyRange || key_OR_range == null) && !?direction) { | 558 if ((key_OR_range is KeyRange || key_OR_range == null) && !?direction) { |
| 423 return _openCursor_2(key_OR_range); | 559 return _openCursor_2(key_OR_range); |
| 424 } | 560 } |
| 425 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri
ng || direction == null)) { | 561 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri
ng || direction == null)) { |
| 426 return _openCursor_3(key_OR_range, direction); | 562 return _openCursor_3(key_OR_range, direction); |
| 427 } | 563 } |
| 428 if (?key_OR_range && !?direction) { | 564 if (?key_OR_range && !?direction) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 447 Request _openCursor_3(key_OR_range, direction) native "IDBIndex__openCursor_3_
Callback"; | 583 Request _openCursor_3(key_OR_range, direction) native "IDBIndex__openCursor_3_
Callback"; |
| 448 | 584 |
| 449 @DomName('IDBIndex._openCursor_4') | 585 @DomName('IDBIndex._openCursor_4') |
| 450 @DocsEditable | 586 @DocsEditable |
| 451 Request _openCursor_4(key_OR_range) native "IDBIndex__openCursor_4_Callback"; | 587 Request _openCursor_4(key_OR_range) native "IDBIndex__openCursor_4_Callback"; |
| 452 | 588 |
| 453 @DomName('IDBIndex._openCursor_5') | 589 @DomName('IDBIndex._openCursor_5') |
| 454 @DocsEditable | 590 @DocsEditable |
| 455 Request _openCursor_5(key_OR_range, direction) native "IDBIndex__openCursor_5_
Callback"; | 591 Request _openCursor_5(key_OR_range, direction) native "IDBIndex__openCursor_5_
Callback"; |
| 456 | 592 |
| 457 Request openKeyCursor([key_OR_range, String direction]) { | 593 Request $dom_openKeyCursor([key_OR_range, String direction]) { |
| 458 if (!?key_OR_range && !?direction) { | 594 if (!?key_OR_range && !?direction) { |
| 459 return _openKeyCursor_1(); | 595 return _openKeyCursor_1(); |
| 460 } | 596 } |
| 461 if ((key_OR_range is KeyRange || key_OR_range == null) && !?direction) { | 597 if ((key_OR_range is KeyRange || key_OR_range == null) && !?direction) { |
| 462 return _openKeyCursor_2(key_OR_range); | 598 return _openKeyCursor_2(key_OR_range); |
| 463 } | 599 } |
| 464 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri
ng || direction == null)) { | 600 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri
ng || direction == null)) { |
| 465 return _openKeyCursor_3(key_OR_range, direction); | 601 return _openKeyCursor_3(key_OR_range, direction); |
| 466 } | 602 } |
| 467 if (?key_OR_range && !?direction) { | 603 if (?key_OR_range && !?direction) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 731 |
| 596 } | 732 } |
| 597 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 733 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 598 // for details. All rights reserved. Use of this source code is governed by a | 734 // for details. All rights reserved. Use of this source code is governed by a |
| 599 // BSD-style license that can be found in the LICENSE file. | 735 // BSD-style license that can be found in the LICENSE file. |
| 600 | 736 |
| 601 | 737 |
| 602 @DomName('IDBObjectStore') | 738 @DomName('IDBObjectStore') |
| 603 class ObjectStore extends NativeFieldWrapperClass1 { | 739 class ObjectStore extends NativeFieldWrapperClass1 { |
| 604 | 740 |
| 741 @DomName('IDBObjectStore.add') |
| 742 Future add(value, [key]) { |
| 743 try { |
| 744 var request; |
| 745 if (key != null) { |
| 746 request = $dom_add(value, key); |
| 747 } else { |
| 748 request = $dom_add(value); |
| 749 } |
| 750 return _completeRequest(request); |
| 751 } catch (e, stacktrace) { |
| 752 return new Future.immediateError(e, stacktrace); |
| 753 } |
| 754 } |
| 755 |
| 756 @DomName('IDBObjectStore.clear') |
| 757 Future clear() { |
| 758 try { |
| 759 return _completeRequest($dom_clear()); |
| 760 } catch (e, stacktrace) { |
| 761 return new Future.immediateError(e, stacktrace); |
| 762 } |
| 763 } |
| 764 |
| 765 @DomName('IDBObjectStore.delete') |
| 766 Future delete(key_OR_keyRange){ |
| 767 try { |
| 768 return _completeRequest($dom_delete(key_OR_keyRange)); |
| 769 } catch (e, stacktrace) { |
| 770 return new Future.immediateError(e, stacktrace); |
| 771 } |
| 772 } |
| 773 |
| 774 @DomName('IDBObjectStore.count') |
| 775 Future<int> count([key_OR_range]) { |
| 776 try { |
| 777 var request; |
| 778 if (key_OR_range != null) { |
| 779 request = $dom_count(key_OR_range); |
| 780 } else { |
| 781 request = $dom_count(); |
| 782 } |
| 783 return _completeRequest(request); |
| 784 } catch (e, stacktrace) { |
| 785 return new Future.immediateError(e, stacktrace); |
| 786 } |
| 787 } |
| 788 |
| 605 @DomName('IDBObjectStore.put') | 789 @DomName('IDBObjectStore.put') |
| 606 Future put(value, [key]) { | 790 Future put(value, [key]) { |
| 607 try { | 791 try { |
| 608 var request; | 792 var request; |
| 609 if (key != null) { | 793 if (key != null) { |
| 610 request = $dom_put(value, key); | 794 request = $dom_put(value, key); |
| 611 } else { | 795 } else { |
| 612 request = $dom_put(value); | 796 request = $dom_put(value); |
| 613 } | 797 } |
| 614 return _completeRequest(request); | 798 return _completeRequest(request); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 // TODO: try/catch this and return a stream with an immediate error. | 849 // TODO: try/catch this and return a stream with an immediate error. |
| 666 var request; | 850 var request; |
| 667 if (direction == null) { | 851 if (direction == null) { |
| 668 request = $dom_openCursor(key_OR_range); | 852 request = $dom_openCursor(key_OR_range); |
| 669 } else { | 853 } else { |
| 670 request = $dom_openCursor(key_OR_range, direction); | 854 request = $dom_openCursor(key_OR_range, direction); |
| 671 } | 855 } |
| 672 return _cursorStreamFromResult(request, autoAdvance); | 856 return _cursorStreamFromResult(request, autoAdvance); |
| 673 } | 857 } |
| 674 | 858 |
| 859 @DomName('IDBObjectStore.createIndex') |
| 860 Index createIndex(String name, keyPath, {bool unique, bool multiEntry}) { |
| 861 var options = {}; |
| 862 if (unique != null) { |
| 863 options['unique'] = unique; |
| 864 } |
| 865 if (multiEntry != null) { |
| 866 options['multiEntry'] = multiEntry; |
| 867 } |
| 868 |
| 869 return $dom_createIndex(name, keyPath, options); |
| 870 } |
| 871 |
| 675 ObjectStore.internal(); | 872 ObjectStore.internal(); |
| 676 | 873 |
| 677 @DomName('IDBObjectStore.autoIncrement') | 874 @DomName('IDBObjectStore.autoIncrement') |
| 678 @DocsEditable | 875 @DocsEditable |
| 679 bool get autoIncrement native "IDBObjectStore_autoIncrement_Getter"; | 876 bool get autoIncrement native "IDBObjectStore_autoIncrement_Getter"; |
| 680 | 877 |
| 681 @DomName('IDBObjectStore.indexNames') | 878 @DomName('IDBObjectStore.indexNames') |
| 682 @DocsEditable | 879 @DocsEditable |
| 683 List<String> get indexNames native "IDBObjectStore_indexNames_Getter"; | 880 List<String> get indexNames native "IDBObjectStore_indexNames_Getter"; |
| 684 | 881 |
| 685 @DomName('IDBObjectStore.keyPath') | 882 @DomName('IDBObjectStore.keyPath') |
| 686 @DocsEditable | 883 @DocsEditable |
| 687 dynamic get keyPath native "IDBObjectStore_keyPath_Getter"; | 884 dynamic get keyPath native "IDBObjectStore_keyPath_Getter"; |
| 688 | 885 |
| 689 @DomName('IDBObjectStore.name') | 886 @DomName('IDBObjectStore.name') |
| 690 @DocsEditable | 887 @DocsEditable |
| 691 String get name native "IDBObjectStore_name_Getter"; | 888 String get name native "IDBObjectStore_name_Getter"; |
| 692 | 889 |
| 693 @DomName('IDBObjectStore.transaction') | 890 @DomName('IDBObjectStore.transaction') |
| 694 @DocsEditable | 891 @DocsEditable |
| 695 Transaction get transaction native "IDBObjectStore_transaction_Getter"; | 892 Transaction get transaction native "IDBObjectStore_transaction_Getter"; |
| 696 | 893 |
| 697 Request add(Object value, [Object key]) { | 894 Request $dom_add(Object value, [Object key]) { |
| 698 if (?key) { | 895 if (?key) { |
| 699 return _add_1(value, key); | 896 return _add_1(value, key); |
| 700 } | 897 } |
| 701 return _add_2(value); | 898 return _add_2(value); |
| 702 } | 899 } |
| 703 | 900 |
| 704 @DomName('IDBObjectStore._add_1') | 901 @DomName('IDBObjectStore._add_1') |
| 705 @DocsEditable | 902 @DocsEditable |
| 706 Request _add_1(value, key) native "IDBObjectStore__add_1_Callback"; | 903 Request _add_1(value, key) native "IDBObjectStore__add_1_Callback"; |
| 707 | 904 |
| 708 @DomName('IDBObjectStore._add_2') | 905 @DomName('IDBObjectStore._add_2') |
| 709 @DocsEditable | 906 @DocsEditable |
| 710 Request _add_2(value) native "IDBObjectStore__add_2_Callback"; | 907 Request _add_2(value) native "IDBObjectStore__add_2_Callback"; |
| 711 | 908 |
| 712 @DomName('IDBObjectStore.clear') | 909 @DomName('IDBObjectStore.clear') |
| 713 @DocsEditable | 910 @DocsEditable |
| 714 Request clear() native "IDBObjectStore_clear_Callback"; | 911 Request $dom_clear() native "IDBObjectStore_clear_Callback"; |
| 715 | 912 |
| 716 Request count([key_OR_range]) { | 913 Request $dom_count([key_OR_range]) { |
| 717 if (!?key_OR_range) { | 914 if (!?key_OR_range) { |
| 718 return _count_1(); | 915 return _count_1(); |
| 719 } | 916 } |
| 720 if ((key_OR_range is KeyRange || key_OR_range == null)) { | 917 if ((key_OR_range is KeyRange || key_OR_range == null)) { |
| 721 return _count_2(key_OR_range); | 918 return _count_2(key_OR_range); |
| 722 } | 919 } |
| 723 if (?key_OR_range) { | 920 if (?key_OR_range) { |
| 724 return _count_3(key_OR_range); | 921 return _count_3(key_OR_range); |
| 725 } | 922 } |
| 726 throw new ArgumentError("Incorrect number or type of arguments"); | 923 throw new ArgumentError("Incorrect number or type of arguments"); |
| 727 } | 924 } |
| 728 | 925 |
| 729 @DomName('IDBObjectStore._count_1') | 926 @DomName('IDBObjectStore._count_1') |
| 730 @DocsEditable | 927 @DocsEditable |
| 731 Request _count_1() native "IDBObjectStore__count_1_Callback"; | 928 Request _count_1() native "IDBObjectStore__count_1_Callback"; |
| 732 | 929 |
| 733 @DomName('IDBObjectStore._count_2') | 930 @DomName('IDBObjectStore._count_2') |
| 734 @DocsEditable | 931 @DocsEditable |
| 735 Request _count_2(key_OR_range) native "IDBObjectStore__count_2_Callback"; | 932 Request _count_2(key_OR_range) native "IDBObjectStore__count_2_Callback"; |
| 736 | 933 |
| 737 @DomName('IDBObjectStore._count_3') | 934 @DomName('IDBObjectStore._count_3') |
| 738 @DocsEditable | 935 @DocsEditable |
| 739 Request _count_3(key_OR_range) native "IDBObjectStore__count_3_Callback"; | 936 Request _count_3(key_OR_range) native "IDBObjectStore__count_3_Callback"; |
| 740 | 937 |
| 741 Index createIndex(String name, keyPath, [Map options]) { | 938 Index $dom_createIndex(String name, keyPath, [Map options]) { |
| 742 if ((name is String || name == null) && (keyPath is List<String> || keyPath
== null) && (options is Map || options == null)) { | 939 if ((name is String || name == null) && (keyPath is List<String> || keyPath
== null) && (options is Map || options == null)) { |
| 743 return _createIndex_1(name, keyPath, options); | 940 return _createIndex_1(name, keyPath, options); |
| 744 } | 941 } |
| 745 if ((name is String || name == null) && (keyPath is String || keyPath == nul
l) && (options is Map || options == null)) { | 942 if ((name is String || name == null) && (keyPath is String || keyPath == nul
l) && (options is Map || options == null)) { |
| 746 return _createIndex_2(name, keyPath, options); | 943 return _createIndex_2(name, keyPath, options); |
| 747 } | 944 } |
| 748 throw new ArgumentError("Incorrect number or type of arguments"); | 945 throw new ArgumentError("Incorrect number or type of arguments"); |
| 749 } | 946 } |
| 750 | 947 |
| 751 @DomName('IDBObjectStore._createIndex_1') | 948 @DomName('IDBObjectStore._createIndex_1') |
| 752 @DocsEditable | 949 @DocsEditable |
| 753 Index _createIndex_1(name, keyPath, options) native "IDBObjectStore__createInd
ex_1_Callback"; | 950 Index _createIndex_1(name, keyPath, options) native "IDBObjectStore__createInd
ex_1_Callback"; |
| 754 | 951 |
| 755 @DomName('IDBObjectStore._createIndex_2') | 952 @DomName('IDBObjectStore._createIndex_2') |
| 756 @DocsEditable | 953 @DocsEditable |
| 757 Index _createIndex_2(name, keyPath, options) native "IDBObjectStore__createInd
ex_2_Callback"; | 954 Index _createIndex_2(name, keyPath, options) native "IDBObjectStore__createInd
ex_2_Callback"; |
| 758 | 955 |
| 759 Request delete(key_OR_keyRange) { | 956 Request $dom_delete(key_OR_keyRange) { |
| 760 if ((key_OR_keyRange is KeyRange || key_OR_keyRange == null)) { | 957 if ((key_OR_keyRange is KeyRange || key_OR_keyRange == null)) { |
| 761 return _delete_1(key_OR_keyRange); | 958 return _delete_1(key_OR_keyRange); |
| 762 } | 959 } |
| 763 if (?key_OR_keyRange) { | 960 if (?key_OR_keyRange) { |
| 764 return _delete_2(key_OR_keyRange); | 961 return _delete_2(key_OR_keyRange); |
| 765 } | 962 } |
| 766 throw new ArgumentError("Incorrect number or type of arguments"); | 963 throw new ArgumentError("Incorrect number or type of arguments"); |
| 767 } | 964 } |
| 768 | 965 |
| 769 @DomName('IDBObjectStore._delete_1') | 966 @DomName('IDBObjectStore._delete_1') |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 | 1304 |
| 1108 // WARNING: Do not edit - generated code. | 1305 // WARNING: Do not edit - generated code. |
| 1109 | 1306 |
| 1110 | 1307 |
| 1111 @DocsEditable | 1308 @DocsEditable |
| 1112 @DomName('IDBAny') | 1309 @DomName('IDBAny') |
| 1113 class _IDBAny extends NativeFieldWrapperClass1 { | 1310 class _IDBAny extends NativeFieldWrapperClass1 { |
| 1114 _IDBAny.internal(); | 1311 _IDBAny.internal(); |
| 1115 | 1312 |
| 1116 } | 1313 } |
| OLD | NEW |