| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 import 'dart:nativewrappers'; | 78 import 'dart:nativewrappers'; |
| 79 import 'dart:_blink' as _blink; | 79 import 'dart:_blink' as _blink; |
| 80 import 'dart:js' as js; | 80 import 'dart:js' as js; |
| 81 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 81 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 82 // for details. All rights reserved. Use of this source code is governed by a | 82 // for details. All rights reserved. Use of this source code is governed by a |
| 83 // BSD-style license that can be found in the LICENSE file. | 83 // BSD-style license that can be found in the LICENSE file. |
| 84 | 84 |
| 85 // DO NOT EDIT | 85 // DO NOT EDIT |
| 86 // Auto-generated dart:indexed_db library. | 86 // Auto-generated dart:indexed_db library. |
| 87 | 87 |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 class _KeyRangeFactoryProvider { | 88 class _KeyRangeFactoryProvider { |
| 93 | |
| 94 static KeyRange createKeyRange_only(/*IDBKey*/ value) => | 89 static KeyRange createKeyRange_only(/*IDBKey*/ value) => |
| 95 KeyRange.only_(value); | 90 KeyRange.only_(value); |
| 96 | 91 |
| 97 static KeyRange createKeyRange_lowerBound( | 92 static KeyRange createKeyRange_lowerBound( |
| 98 /*IDBKey*/ bound, [bool open = false]) => | 93 /*IDBKey*/ bound, |
| 94 [bool open = false]) => |
| 99 KeyRange.lowerBound_(bound, open); | 95 KeyRange.lowerBound_(bound, open); |
| 100 | 96 |
| 101 static KeyRange createKeyRange_upperBound( | 97 static KeyRange createKeyRange_upperBound( |
| 102 /*IDBKey*/ bound, [bool open = false]) => | 98 /*IDBKey*/ bound, |
| 99 [bool open = false]) => |
| 103 KeyRange.upperBound_(bound, open); | 100 KeyRange.upperBound_(bound, open); |
| 104 | 101 |
| 105 static KeyRange createKeyRange_bound( | 102 static KeyRange createKeyRange_bound( |
| 106 /*IDBKey*/ lower, /*IDBKey*/ upper, | 103 /*IDBKey*/ lower, |
| 107 [bool lowerOpen = false, bool upperOpen = false]) => | 104 /*IDBKey*/ upper, |
| 105 [bool lowerOpen = false, |
| 106 bool upperOpen = false]) => |
| 108 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); | 107 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); |
| 109 } | 108 } |
| 109 |
| 110 // FIXME: Can we make this private? | 110 // FIXME: Can we make this private? |
| 111 @Deprecated("Internal Use Only") | 111 @Deprecated("Internal Use Only") |
| 112 final indexed_dbBlinkMap = { | 112 final indexed_dbBlinkMap = { |
| 113 'IDBCursor': () => Cursor.instanceRuntimeType, | 113 'IDBCursor': () => Cursor.instanceRuntimeType, |
| 114 'IDBCursorWithValue': () => CursorWithValue.instanceRuntimeType, | 114 'IDBCursorWithValue': () => CursorWithValue.instanceRuntimeType, |
| 115 'IDBDatabase': () => Database.instanceRuntimeType, | 115 'IDBDatabase': () => Database.instanceRuntimeType, |
| 116 'IDBFactory': () => IdbFactory.instanceRuntimeType, | 116 'IDBFactory': () => IdbFactory.instanceRuntimeType, |
| 117 'IDBIndex': () => Index.instanceRuntimeType, | 117 'IDBIndex': () => Index.instanceRuntimeType, |
| 118 'IDBKeyRange': () => KeyRange.instanceRuntimeType, | 118 'IDBKeyRange': () => KeyRange.instanceRuntimeType, |
| 119 'IDBObjectStore': () => ObjectStore.instanceRuntimeType, | 119 'IDBObjectStore': () => ObjectStore.instanceRuntimeType, |
| 120 'IDBOpenDBRequest': () => OpenDBRequest.instanceRuntimeType, | 120 'IDBOpenDBRequest': () => OpenDBRequest.instanceRuntimeType, |
| 121 'IDBRequest': () => Request.instanceRuntimeType, | 121 'IDBRequest': () => Request.instanceRuntimeType, |
| 122 'IDBTransaction': () => Transaction.instanceRuntimeType, | 122 'IDBTransaction': () => Transaction.instanceRuntimeType, |
| 123 'IDBVersionChangeEvent': () => VersionChangeEvent.instanceRuntimeType, | 123 'IDBVersionChangeEvent': () => VersionChangeEvent.instanceRuntimeType, |
| 124 | |
| 125 }; | 124 }; |
| 126 | 125 |
| 127 | |
| 128 // | 126 // |
| 129 // Per http://www.w3.org/TR/IndexedDB/#key-construct | 127 // Per http://www.w3.org/TR/IndexedDB/#key-construct |
| 130 // | 128 // |
| 131 // "A value is said to be a valid key if it is one of the following types: Array | 129 // "A value is said to be a valid key if it is one of the following types: Array |
| 132 // JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [ECMA-262] or float | 130 // JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [ECMA-262] or float |
| 133 // [WEBIDL]. However Arrays are only valid keys if every item in the array is | 131 // [WEBIDL]. However Arrays are only valid keys if every item in the array is |
| 134 // defined and is a valid key (i.e. sparse arrays can not be valid keys) and if | 132 // defined and is a valid key (i.e. sparse arrays can not be valid keys) and if |
| 135 // the Array doesn't directly or indirectly contain itself. Any non-numeric | 133 // the Array doesn't directly or indirectly contain itself. Any non-numeric |
| 136 // properties are ignored, and thus does not affect whether the Array is a valid | 134 // properties are ignored, and thus does not affect whether the Array is a valid |
| 137 // key. Additionally, if the value is of type float, it is only a valid key if | 135 // key. Additionally, if the value is of type float, it is only a valid key if |
| 138 // it is not NaN, and if the value is of type Date it is only a valid key if its | 136 // it is not NaN, and if the value is of type Date it is only a valid key if its |
| 139 // [[PrimitiveValue]] internal property, as defined by [ECMA-262], is not NaN." | 137 // [[PrimitiveValue]] internal property, as defined by [ECMA-262], is not NaN." |
| 140 | 138 |
| 141 // What is required is to ensure that an Lists in the key are actually | 139 // What is required is to ensure that an Lists in the key are actually |
| 142 // JavaScript arrays, and any Dates are JavaScript Dates. | 140 // JavaScript arrays, and any Dates are JavaScript Dates. |
| 143 | 141 |
| 144 | |
| 145 /** | 142 /** |
| 146 * Converts a native IDBKey into a Dart object. | 143 * Converts a native IDBKey into a Dart object. |
| 147 * | 144 * |
| 148 * May return the original input. May mutate the original input (but will be | 145 * May return the original input. May mutate the original input (but will be |
| 149 * idempotent if mutation occurs). It is assumed that this conversion happens | 146 * idempotent if mutation occurs). It is assumed that this conversion happens |
| 150 * on native IDBKeys on all paths that return IDBKeys from native DOM calls. | 147 * on native IDBKeys on all paths that return IDBKeys from native DOM calls. |
| 151 * | 148 * |
| 152 * If necessary, JavaScript Dates are converted into Dart Dates. | 149 * If necessary, JavaScript Dates are converted into Dart Dates. |
| 153 */ | 150 */ |
| 154 _convertNativeToDart_IDBKey(nativeKey) { | 151 _convertNativeToDart_IDBKey(nativeKey) { |
| 155 containsDate(object) { | 152 containsDate(object) { |
| 156 if (object is DateTime) return true; | 153 if (object is DateTime) return true; |
| 157 if (object is List) { | 154 if (object is List) { |
| 158 for (int i = 0; i < object.length; i++) { | 155 for (int i = 0; i < object.length; i++) { |
| 159 if (containsDate(object[i])) return true; | 156 if (containsDate(object[i])) return true; |
| 160 } | 157 } |
| 161 } | 158 } |
| 162 return false; // number, string. | 159 return false; // number, string. |
| 163 } | 160 } |
| 161 |
| 164 if (nativeKey is DateTime) { | 162 if (nativeKey is DateTime) { |
| 165 throw new UnimplementedError('Key containing DateTime'); | 163 throw new UnimplementedError('Key containing DateTime'); |
| 166 } | 164 } |
| 167 // TODO: Cache conversion somewhere? | 165 // TODO: Cache conversion somewhere? |
| 168 return nativeKey; | 166 return nativeKey; |
| 169 } | 167 } |
| 170 | 168 |
| 171 /** | 169 /** |
| 172 * Converts a Dart object into a valid IDBKey. | 170 * Converts a Dart object into a valid IDBKey. |
| 173 * | 171 * |
| 174 * May return the original input. Does not mutate input. | 172 * May return the original input. Does not mutate input. |
| 175 * | 173 * |
| 176 * If necessary, [dartKey] may be copied to ensure all lists are converted into | 174 * If necessary, [dartKey] may be copied to ensure all lists are converted into |
| 177 * JavaScript Arrays and Dart Dates into JavaScript Dates. | 175 * JavaScript Arrays and Dart Dates into JavaScript Dates. |
| 178 */ | 176 */ |
| 179 _convertDartToNative_IDBKey(dartKey) { | 177 _convertDartToNative_IDBKey(dartKey) { |
| 180 // TODO: Implement. | 178 // TODO: Implement. |
| 181 return dartKey; | 179 return dartKey; |
| 182 } | 180 } |
| 183 | 181 |
| 184 | |
| 185 | |
| 186 /// May modify original. If so, action is idempotent. | 182 /// May modify original. If so, action is idempotent. |
| 187 _convertNativeToDart_IDBAny(object) { | 183 _convertNativeToDart_IDBAny(object) { |
| 188 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false); | 184 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false); |
| 189 }// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 185 } // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 190 // for details. All rights reserved. Use of this source code is governed by a | 186 // for details. All rights reserved. Use of this source code is governed by a |
| 191 // BSD-style license that can be found in the LICENSE file. | 187 // BSD-style license that can be found in the LICENSE file. |
| 192 | 188 |
| 193 | |
| 194 @DomName('IDBCursor') | 189 @DomName('IDBCursor') |
| 195 @Unstable() | 190 @Unstable() |
| 196 class Cursor extends DartHtmlDomObject { | 191 class Cursor extends DartHtmlDomObject { |
| 197 @DomName('IDBCursor.delete') | 192 @DomName('IDBCursor.delete') |
| 198 Future delete() { | 193 Future delete() { |
| 199 try { | 194 try { |
| 200 return _completeRequest(_delete()); | 195 return _completeRequest(_delete()); |
| 201 } catch (e, stacktrace) { | 196 } catch (e, stacktrace) { |
| 202 return new Future.error(e, stacktrace); | 197 return new Future.error(e, stacktrace); |
| 203 } | 198 } |
| 204 } | 199 } |
| 205 | 200 |
| 206 @DomName('IDBCursor.value') | 201 @DomName('IDBCursor.value') |
| 207 Future update(value) { | 202 Future update(value) { |
| 208 try { | 203 try { |
| 209 return _completeRequest(_update(value)); | 204 return _completeRequest(_update(value)); |
| 210 } catch (e, stacktrace) { | 205 } catch (e, stacktrace) { |
| 211 return new Future.error(e, stacktrace); | 206 return new Future.error(e, stacktrace); |
| 212 } | 207 } |
| 213 } | 208 } |
| 214 | 209 |
| 215 // To suppress missing implicit constructor warnings. | 210 // To suppress missing implicit constructor warnings. |
| 216 factory Cursor._() { throw new UnsupportedError("Not supported"); } | 211 factory Cursor._() { |
| 217 | 212 throw new UnsupportedError("Not supported"); |
| 213 } |
| 218 | 214 |
| 219 @Deprecated("Internal Use Only") | 215 @Deprecated("Internal Use Only") |
| 220 external static Type get instanceRuntimeType; | 216 external static Type get instanceRuntimeType; |
| 221 | 217 |
| 222 @Deprecated("Internal Use Only") | 218 @Deprecated("Internal Use Only") |
| 223 Cursor.internal_() { } | 219 Cursor.internal_() {} |
| 224 | 220 |
| 225 @DomName('IDBCursor.direction') | 221 @DomName('IDBCursor.direction') |
| 226 @DocsEditable() | 222 @DocsEditable() |
| 227 String get direction => _blink.BlinkIDBCursor.instance.direction_Getter_(this)
; | 223 String get direction => |
| 228 | 224 _blink.BlinkIDBCursor.instance.direction_Getter_(this); |
| 225 |
| 229 @DomName('IDBCursor.key') | 226 @DomName('IDBCursor.key') |
| 230 @DocsEditable() | 227 @DocsEditable() |
| 231 Object get key => (_blink.BlinkIDBCursor.instance.key_Getter_(this)); | 228 Object get key => (_blink.BlinkIDBCursor.instance.key_Getter_(this)); |
| 232 | 229 |
| 233 @DomName('IDBCursor.primaryKey') | 230 @DomName('IDBCursor.primaryKey') |
| 234 @DocsEditable() | 231 @DocsEditable() |
| 235 Object get primaryKey => (_blink.BlinkIDBCursor.instance.primaryKey_Getter_(th
is)); | 232 Object get primaryKey => |
| 236 | 233 (_blink.BlinkIDBCursor.instance.primaryKey_Getter_(this)); |
| 234 |
| 237 @DomName('IDBCursor.source') | 235 @DomName('IDBCursor.source') |
| 238 @DocsEditable() | 236 @DocsEditable() |
| 239 Object get source => (_blink.BlinkIDBCursor.instance.source_Getter_(this)); | 237 Object get source => (_blink.BlinkIDBCursor.instance.source_Getter_(this)); |
| 240 | 238 |
| 241 @DomName('IDBCursor.advance') | 239 @DomName('IDBCursor.advance') |
| 242 @DocsEditable() | 240 @DocsEditable() |
| 243 void advance(int count) => _blink.BlinkIDBCursor.instance.advance_Callback_1_(
this, count); | 241 void advance(int count) => |
| 244 | 242 _blink.BlinkIDBCursor.instance.advance_Callback_1_(this, count); |
| 243 |
| 245 @DomName('IDBCursor.continuePrimaryKey') | 244 @DomName('IDBCursor.continuePrimaryKey') |
| 246 @DocsEditable() | 245 @DocsEditable() |
| 247 @Experimental() // untriaged | 246 @Experimental() // untriaged |
| 248 void continuePrimaryKey(Object key, Object primaryKey) => _blink.BlinkIDBCurso
r.instance.continuePrimaryKey_Callback_2_(this, key, primaryKey); | 247 void continuePrimaryKey(Object key, Object primaryKey) => |
| 249 | 248 _blink.BlinkIDBCursor.instance |
| 249 .continuePrimaryKey_Callback_2_(this, key, primaryKey); |
| 250 |
| 250 @DomName('IDBCursor.delete') | 251 @DomName('IDBCursor.delete') |
| 251 @DocsEditable() | 252 @DocsEditable() |
| 252 Request _delete() => _blink.BlinkIDBCursor.instance.delete_Callback_0_(this); | 253 Request _delete() => _blink.BlinkIDBCursor.instance.delete_Callback_0_(this); |
| 253 | 254 |
| 254 void next([Object key]) { | 255 void next([Object key]) { |
| 255 if (key != null) { | 256 if (key != null) { |
| 256 _blink.BlinkIDBCursor.instance.continue_Callback_1_(this, key); | 257 _blink.BlinkIDBCursor.instance.continue_Callback_1_(this, key); |
| 257 return; | 258 return; |
| 258 } | 259 } |
| 259 _blink.BlinkIDBCursor.instance.continue_Callback_0_(this); | 260 _blink.BlinkIDBCursor.instance.continue_Callback_0_(this); |
| 260 return; | 261 return; |
| 261 } | 262 } |
| 262 | 263 |
| 263 @DomName('IDBCursor.update') | 264 @DomName('IDBCursor.update') |
| 264 @DocsEditable() | 265 @DocsEditable() |
| 265 Request _update(Object value) => _blink.BlinkIDBCursor.instance.update_Callbac
k_1_(this, convertDartToNative_SerializedScriptValue(value)); | 266 Request _update(Object value) => |
| 266 | 267 _blink.BlinkIDBCursor.instance.update_Callback_1_( |
| 268 this, convertDartToNative_SerializedScriptValue(value)); |
| 267 } | 269 } |
| 268 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 270 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 269 // for details. All rights reserved. Use of this source code is governed by a | 271 // for details. All rights reserved. Use of this source code is governed by a |
| 270 // BSD-style license that can be found in the LICENSE file. | 272 // BSD-style license that can be found in the LICENSE file. |
| 271 | 273 |
| 272 // WARNING: Do not edit - generated code. | 274 // WARNING: Do not edit - generated code. |
| 273 | 275 |
| 274 | |
| 275 @DocsEditable() | 276 @DocsEditable() |
| 276 @DomName('IDBCursorWithValue') | 277 @DomName('IDBCursorWithValue') |
| 277 @Unstable() | 278 @Unstable() |
| 278 class CursorWithValue extends Cursor { | 279 class CursorWithValue extends Cursor { |
| 279 // To suppress missing implicit constructor warnings. | 280 // To suppress missing implicit constructor warnings. |
| 280 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); } | 281 factory CursorWithValue._() { |
| 281 | 282 throw new UnsupportedError("Not supported"); |
| 283 } |
| 282 | 284 |
| 283 @Deprecated("Internal Use Only") | 285 @Deprecated("Internal Use Only") |
| 284 external static Type get instanceRuntimeType; | 286 external static Type get instanceRuntimeType; |
| 285 | 287 |
| 286 @Deprecated("Internal Use Only") | 288 @Deprecated("Internal Use Only") |
| 287 CursorWithValue.internal_() : super.internal_(); | 289 CursorWithValue.internal_() : super.internal_(); |
| 288 | 290 |
| 289 | |
| 290 @DomName('IDBCursorWithValue.value') | 291 @DomName('IDBCursorWithValue.value') |
| 291 @DocsEditable() | 292 @DocsEditable() |
| 292 Object get value => _convertNativeToDart_IDBAny(_blink.BlinkIDBCursorWithValue
.instance.value_Getter_(this)); | 293 Object get value => _convertNativeToDart_IDBAny( |
| 293 | 294 _blink.BlinkIDBCursorWithValue.instance.value_Getter_(this)); |
| 294 } | 295 } |
| 295 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 296 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 296 // for details. All rights reserved. Use of this source code is governed by a | 297 // for details. All rights reserved. Use of this source code is governed by a |
| 297 // BSD-style license that can be found in the LICENSE file. | 298 // BSD-style license that can be found in the LICENSE file. |
| 298 | 299 |
| 299 | |
| 300 @DocsEditable() | 300 @DocsEditable() |
| 301 /** | 301 /** |
| 302 * An indexed database object for storing client-side data | 302 * An indexed database object for storing client-side data |
| 303 * in web apps. | 303 * in web apps. |
| 304 */ | 304 */ |
| 305 @DomName('IDBDatabase') | 305 @DomName('IDBDatabase') |
| 306 @SupportedBrowser(SupportedBrowser.CHROME) | 306 @SupportedBrowser(SupportedBrowser.CHROME) |
| 307 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') | 307 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') |
| 308 @SupportedBrowser(SupportedBrowser.IE, '10') | 308 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 309 @Experimental() | 309 @Experimental() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 324 return _createObjectStore(name, options); | 324 return _createObjectStore(name, options); |
| 325 } | 325 } |
| 326 | 326 |
| 327 Transaction transaction(storeName_OR_storeNames, String mode) { | 327 Transaction transaction(storeName_OR_storeNames, String mode) { |
| 328 if (mode != 'readonly' && mode != 'readwrite') { | 328 if (mode != 'readonly' && mode != 'readwrite') { |
| 329 throw new ArgumentError("Invalid transaction mode $mode"); | 329 throw new ArgumentError("Invalid transaction mode $mode"); |
| 330 } | 330 } |
| 331 var names; | 331 var names; |
| 332 if (storeName_OR_storeNames == null) { | 332 if (storeName_OR_storeNames == null) { |
| 333 throw new ArgumentError("stores may not be null in transaction"); | 333 throw new ArgumentError("stores may not be null in transaction"); |
| 334 } else if (storeName_OR_storeNames is String || storeName_OR_storeNames is D
omStringList) { | 334 } else if (storeName_OR_storeNames is String || |
| 335 storeName_OR_storeNames is DomStringList) { |
| 335 names = storeName_OR_storeNames; | 336 names = storeName_OR_storeNames; |
| 336 } else if (storeName_OR_storeNames is List<String>) { | 337 } else if (storeName_OR_storeNames is List<String>) { |
| 337 names = convertDartToNative_List(storeName_OR_storeNames); | 338 names = convertDartToNative_List(storeName_OR_storeNames); |
| 338 } else { | 339 } else { |
| 339 throw new ArgumentError("Invalid store(s) $store_Name_OR_storeNames"); | 340 throw new ArgumentError("Invalid store(s) $store_Name_OR_storeNames"); |
| 340 } | 341 } |
| 341 | 342 |
| 342 return _blink.BlinkIDBDatabase.instance.transaction_Callback_2_(this, names,
mode); | 343 return _blink.BlinkIDBDatabase.instance |
| 344 .transaction_Callback_2_(this, names, mode); |
| 343 } | 345 } |
| 344 | 346 |
| 345 Transaction transactionList(List<String> storeNames, String mode) => transacti
on(storeNames, mode); | 347 Transaction transactionList(List<String> storeNames, String mode) => |
| 346 Transaction transactionStores(List<String> storeNames, String mode) => transac
tion(storeNames, mode); | 348 transaction(storeNames, mode); |
| 347 Transaction transactionStore(String storeName, String mode) => transaction(sto
reName, mode); | 349 Transaction transactionStores(List<String> storeNames, String mode) => |
| 350 transaction(storeNames, mode); |
| 351 Transaction transactionStore(String storeName, String mode) => |
| 352 transaction(storeName, mode); |
| 348 | 353 |
| 349 // To suppress missing implicit constructor warnings. | 354 // To suppress missing implicit constructor warnings. |
| 350 factory Database._() { throw new UnsupportedError("Not supported"); } | 355 factory Database._() { |
| 356 throw new UnsupportedError("Not supported"); |
| 357 } |
| 351 | 358 |
| 352 /** | 359 /** |
| 353 * Static factory designed to expose `abort` events to event | 360 * Static factory designed to expose `abort` events to event |
| 354 * handlers that are not necessarily instances of [Database]. | 361 * handlers that are not necessarily instances of [Database]. |
| 355 * | 362 * |
| 356 * See [EventStreamProvider] for usage information. | 363 * See [EventStreamProvider] for usage information. |
| 357 */ | 364 */ |
| 358 @DomName('IDBDatabase.abortEvent') | 365 @DomName('IDBDatabase.abortEvent') |
| 359 @DocsEditable() | 366 @DocsEditable() |
| 360 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 367 static const EventStreamProvider<Event> abortEvent = |
| 368 const EventStreamProvider<Event>('abort'); |
| 361 | 369 |
| 362 /** | 370 /** |
| 363 * Static factory designed to expose `close` events to event | 371 * Static factory designed to expose `close` events to event |
| 364 * handlers that are not necessarily instances of [Database]. | 372 * handlers that are not necessarily instances of [Database]. |
| 365 * | 373 * |
| 366 * See [EventStreamProvider] for usage information. | 374 * See [EventStreamProvider] for usage information. |
| 367 */ | 375 */ |
| 368 @DomName('IDBDatabase.closeEvent') | 376 @DomName('IDBDatabase.closeEvent') |
| 369 @DocsEditable() | 377 @DocsEditable() |
| 370 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 | 378 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 |
| 371 @Experimental() | 379 @Experimental() |
| 372 static const EventStreamProvider<Event> closeEvent = const EventStreamProvider
<Event>('close'); | 380 static const EventStreamProvider<Event> closeEvent = |
| 381 const EventStreamProvider<Event>('close'); |
| 373 | 382 |
| 374 /** | 383 /** |
| 375 * Static factory designed to expose `error` events to event | 384 * Static factory designed to expose `error` events to event |
| 376 * handlers that are not necessarily instances of [Database]. | 385 * handlers that are not necessarily instances of [Database]. |
| 377 * | 386 * |
| 378 * See [EventStreamProvider] for usage information. | 387 * See [EventStreamProvider] for usage information. |
| 379 */ | 388 */ |
| 380 @DomName('IDBDatabase.errorEvent') | 389 @DomName('IDBDatabase.errorEvent') |
| 381 @DocsEditable() | 390 @DocsEditable() |
| 382 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 391 static const EventStreamProvider<Event> errorEvent = |
| 392 const EventStreamProvider<Event>('error'); |
| 383 | 393 |
| 384 /** | 394 /** |
| 385 * Static factory designed to expose `versionchange` events to event | 395 * Static factory designed to expose `versionchange` events to event |
| 386 * handlers that are not necessarily instances of [Database]. | 396 * handlers that are not necessarily instances of [Database]. |
| 387 * | 397 * |
| 388 * See [EventStreamProvider] for usage information. | 398 * See [EventStreamProvider] for usage information. |
| 389 */ | 399 */ |
| 390 @DomName('IDBDatabase.versionchangeEvent') | 400 @DomName('IDBDatabase.versionchangeEvent') |
| 391 @DocsEditable() | 401 @DocsEditable() |
| 392 static const EventStreamProvider<VersionChangeEvent> versionChangeEvent = cons
t EventStreamProvider<VersionChangeEvent>('versionchange'); | 402 static const EventStreamProvider<VersionChangeEvent> versionChangeEvent = |
| 393 | 403 const EventStreamProvider<VersionChangeEvent>('versionchange'); |
| 394 | 404 |
| 395 @Deprecated("Internal Use Only") | 405 @Deprecated("Internal Use Only") |
| 396 external static Type get instanceRuntimeType; | 406 external static Type get instanceRuntimeType; |
| 397 | 407 |
| 398 @Deprecated("Internal Use Only") | 408 @Deprecated("Internal Use Only") |
| 399 Database.internal_() : super.internal_(); | 409 Database.internal_() : super.internal_(); |
| 400 | 410 |
| 401 | |
| 402 @DomName('IDBDatabase.name') | 411 @DomName('IDBDatabase.name') |
| 403 @DocsEditable() | 412 @DocsEditable() |
| 404 String get name => _blink.BlinkIDBDatabase.instance.name_Getter_(this); | 413 String get name => _blink.BlinkIDBDatabase.instance.name_Getter_(this); |
| 405 | 414 |
| 406 @DomName('IDBDatabase.objectStoreNames') | 415 @DomName('IDBDatabase.objectStoreNames') |
| 407 @DocsEditable() | 416 @DocsEditable() |
| 408 List<String> get objectStoreNames => _blink.BlinkIDBDatabase.instance.objectSt
oreNames_Getter_(this); | 417 List<String> get objectStoreNames => |
| 409 | 418 _blink.BlinkIDBDatabase.instance.objectStoreNames_Getter_(this); |
| 419 |
| 410 @DomName('IDBDatabase.version') | 420 @DomName('IDBDatabase.version') |
| 411 @DocsEditable() | 421 @DocsEditable() |
| 412 Object get version => (_blink.BlinkIDBDatabase.instance.version_Getter_(this))
; | 422 Object get version => |
| 413 | 423 (_blink.BlinkIDBDatabase.instance.version_Getter_(this)); |
| 424 |
| 414 @DomName('IDBDatabase.close') | 425 @DomName('IDBDatabase.close') |
| 415 @DocsEditable() | 426 @DocsEditable() |
| 416 void close() => _blink.BlinkIDBDatabase.instance.close_Callback_0_(this); | 427 void close() => _blink.BlinkIDBDatabase.instance.close_Callback_0_(this); |
| 417 | 428 |
| 418 ObjectStore _createObjectStore(String name, [Map options]) { | 429 ObjectStore _createObjectStore(String name, [Map options]) { |
| 419 if (options != null) { | 430 if (options != null) { |
| 420 return _blink.BlinkIDBDatabase.instance.createObjectStore_Callback_2_(this
, name, convertDartToNative_Dictionary(options)); | 431 return _blink.BlinkIDBDatabase.instance.createObjectStore_Callback_2_( |
| 432 this, name, convertDartToNative_Dictionary(options)); |
| 421 } | 433 } |
| 422 return _blink.BlinkIDBDatabase.instance.createObjectStore_Callback_1_(this,
name); | 434 return _blink.BlinkIDBDatabase.instance |
| 435 .createObjectStore_Callback_1_(this, name); |
| 423 } | 436 } |
| 424 | 437 |
| 425 @DomName('IDBDatabase.deleteObjectStore') | 438 @DomName('IDBDatabase.deleteObjectStore') |
| 426 @DocsEditable() | 439 @DocsEditable() |
| 427 void deleteObjectStore(String name) => _blink.BlinkIDBDatabase.instance.delete
ObjectStore_Callback_1_(this, name); | 440 void deleteObjectStore(String name) => _blink.BlinkIDBDatabase.instance |
| 428 | 441 .deleteObjectStore_Callback_1_(this, name); |
| 442 |
| 429 /// Stream of `abort` events handled by this [Database]. | 443 /// Stream of `abort` events handled by this [Database]. |
| 430 @DomName('IDBDatabase.onabort') | 444 @DomName('IDBDatabase.onabort') |
| 431 @DocsEditable() | 445 @DocsEditable() |
| 432 Stream<Event> get onAbort => abortEvent.forTarget(this); | 446 Stream<Event> get onAbort => abortEvent.forTarget(this); |
| 433 | 447 |
| 434 /// Stream of `close` events handled by this [Database]. | 448 /// Stream of `close` events handled by this [Database]. |
| 435 @DomName('IDBDatabase.onclose') | 449 @DomName('IDBDatabase.onclose') |
| 436 @DocsEditable() | 450 @DocsEditable() |
| 437 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 | 451 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 |
| 438 @Experimental() | 452 @Experimental() |
| 439 Stream<Event> get onClose => closeEvent.forTarget(this); | 453 Stream<Event> get onClose => closeEvent.forTarget(this); |
| 440 | 454 |
| 441 /// Stream of `error` events handled by this [Database]. | 455 /// Stream of `error` events handled by this [Database]. |
| 442 @DomName('IDBDatabase.onerror') | 456 @DomName('IDBDatabase.onerror') |
| 443 @DocsEditable() | 457 @DocsEditable() |
| 444 Stream<Event> get onError => errorEvent.forTarget(this); | 458 Stream<Event> get onError => errorEvent.forTarget(this); |
| 445 | 459 |
| 446 /// Stream of `versionchange` events handled by this [Database]. | 460 /// Stream of `versionchange` events handled by this [Database]. |
| 447 @DomName('IDBDatabase.onversionchange') | 461 @DomName('IDBDatabase.onversionchange') |
| 448 @DocsEditable() | 462 @DocsEditable() |
| 449 Stream<VersionChangeEvent> get onVersionChange => versionChangeEvent.forTarget
(this); | 463 Stream<VersionChangeEvent> get onVersionChange => |
| 464 versionChangeEvent.forTarget(this); |
| 450 } | 465 } |
| 451 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 466 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 452 // for details. All rights reserved. Use of this source code is governed by a | 467 // for details. All rights reserved. Use of this source code is governed by a |
| 453 // BSD-style license that can be found in the LICENSE file. | 468 // BSD-style license that can be found in the LICENSE file. |
| 454 | 469 |
| 455 | |
| 456 @DomName('IDBFactory') | 470 @DomName('IDBFactory') |
| 457 @SupportedBrowser(SupportedBrowser.CHROME) | 471 @SupportedBrowser(SupportedBrowser.CHROME) |
| 458 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') | 472 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') |
| 459 @SupportedBrowser(SupportedBrowser.IE, '10') | 473 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 460 @Experimental() | 474 @Experimental() |
| 461 @Unstable() | 475 @Unstable() |
| 462 class IdbFactory extends DartHtmlDomObject { | 476 class IdbFactory extends DartHtmlDomObject { |
| 463 /** | 477 /** |
| 464 * Checks to see if Indexed DB is supported on the current platform. | 478 * Checks to see if Indexed DB is supported on the current platform. |
| 465 */ | 479 */ |
| 466 static bool get supported { | 480 static bool get supported { |
| 467 return true; | 481 return true; |
| 468 } | 482 } |
| 469 | 483 |
| 470 @DomName('IDBFactory.open') | 484 @DomName('IDBFactory.open') |
| 471 Future<Database> open(String name, | 485 Future<Database> open(String name, |
| 472 {int version, void onUpgradeNeeded(VersionChangeEvent), | 486 {int version, |
| 487 void onUpgradeNeeded(VersionChangeEvent), |
| 473 void onBlocked(Event)}) { | 488 void onBlocked(Event)}) { |
| 474 if ((version == null) != (onUpgradeNeeded == null)) { | 489 if ((version == null) != (onUpgradeNeeded == null)) { |
| 475 return new Future.error(new ArgumentError( | 490 return new Future.error(new ArgumentError( |
| 476 'version and onUpgradeNeeded must be specified together')); | 491 'version and onUpgradeNeeded must be specified together')); |
| 477 } | 492 } |
| 478 try { | 493 try { |
| 479 var request; | 494 var request; |
| 480 if (version != null) { | 495 if (version != null) { |
| 481 request = _open(name, version); | 496 request = _open(name, version); |
| 482 } else { | 497 } else { |
| 483 request = _open(name); | 498 request = _open(name); |
| 484 } | 499 } |
| 485 | 500 |
| 486 if (onUpgradeNeeded != null) { | 501 if (onUpgradeNeeded != null) { |
| 487 request.onUpgradeNeeded.listen(onUpgradeNeeded); | 502 request.onUpgradeNeeded.listen(onUpgradeNeeded); |
| 488 } | 503 } |
| 489 if (onBlocked != null) { | 504 if (onBlocked != null) { |
| 490 request.onBlocked.listen(onBlocked); | 505 request.onBlocked.listen(onBlocked); |
| 491 } | 506 } |
| 492 return _completeRequest(request); | 507 return _completeRequest(request); |
| 493 } catch (e, stacktrace) { | 508 } catch (e, stacktrace) { |
| 494 return new Future.error(e, stacktrace); | 509 return new Future.error(e, stacktrace); |
| 495 } | 510 } |
| 496 } | 511 } |
| 497 | 512 |
| 498 @DomName('IDBFactory.deleteDatabase') | 513 @DomName('IDBFactory.deleteDatabase') |
| 499 Future<IdbFactory> deleteDatabase(String name, | 514 Future<IdbFactory> deleteDatabase(String name, {void onBlocked(Event e)}) { |
| 500 {void onBlocked(Event e)}) { | |
| 501 try { | 515 try { |
| 502 var request = _deleteDatabase(name); | 516 var request = _deleteDatabase(name); |
| 503 | 517 |
| 504 if (onBlocked != null) { | 518 if (onBlocked != null) { |
| 505 request.onBlocked.listen(onBlocked); | 519 request.onBlocked.listen(onBlocked); |
| 506 } | 520 } |
| 507 var completer = new Completer<IdbFactory>.sync(); | 521 var completer = new Completer<IdbFactory>.sync(); |
| 508 request.onSuccess.listen((e) { | 522 request.onSuccess.listen((e) { |
| 509 completer.complete(this); | 523 completer.complete(this); |
| 510 }); | 524 }); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 529 } | 543 } |
| 530 | 544 |
| 531 /** | 545 /** |
| 532 * Checks to see if getDatabaseNames is supported by the current platform. | 546 * Checks to see if getDatabaseNames is supported by the current platform. |
| 533 */ | 547 */ |
| 534 bool get supportsDatabaseNames { | 548 bool get supportsDatabaseNames { |
| 535 return true; | 549 return true; |
| 536 } | 550 } |
| 537 | 551 |
| 538 // To suppress missing implicit constructor warnings. | 552 // To suppress missing implicit constructor warnings. |
| 539 factory IdbFactory._() { throw new UnsupportedError("Not supported"); } | 553 factory IdbFactory._() { |
| 540 | 554 throw new UnsupportedError("Not supported"); |
| 555 } |
| 541 | 556 |
| 542 @Deprecated("Internal Use Only") | 557 @Deprecated("Internal Use Only") |
| 543 external static Type get instanceRuntimeType; | 558 external static Type get instanceRuntimeType; |
| 544 | 559 |
| 545 @Deprecated("Internal Use Only") | 560 @Deprecated("Internal Use Only") |
| 546 IdbFactory.internal_() { } | 561 IdbFactory.internal_() {} |
| 547 | 562 |
| 548 @DomName('IDBFactory.cmp') | 563 @DomName('IDBFactory.cmp') |
| 549 @DocsEditable() | 564 @DocsEditable() |
| 550 int cmp(Object first, Object second) => _blink.BlinkIDBFactory.instance.cmp_Ca
llback_2_(this, first, second); | 565 int cmp(Object first, Object second) => |
| 551 | 566 _blink.BlinkIDBFactory.instance.cmp_Callback_2_(this, first, second); |
| 567 |
| 552 @DomName('IDBFactory.deleteDatabase') | 568 @DomName('IDBFactory.deleteDatabase') |
| 553 @DocsEditable() | 569 @DocsEditable() |
| 554 OpenDBRequest _deleteDatabase(String name) => _blink.BlinkIDBFactory.instance.
deleteDatabase_Callback_1_(this, name); | 570 OpenDBRequest _deleteDatabase(String name) => |
| 555 | 571 _blink.BlinkIDBFactory.instance.deleteDatabase_Callback_1_(this, name); |
| 572 |
| 556 OpenDBRequest _open(String name, [int version]) { | 573 OpenDBRequest _open(String name, [int version]) { |
| 557 if (version != null) { | 574 if (version != null) { |
| 558 return _blink.BlinkIDBFactory.instance.open_Callback_2_(this, name, versio
n); | 575 return _blink.BlinkIDBFactory.instance |
| 576 .open_Callback_2_(this, name, version); |
| 559 } | 577 } |
| 560 return _blink.BlinkIDBFactory.instance.open_Callback_1_(this, name); | 578 return _blink.BlinkIDBFactory.instance.open_Callback_1_(this, name); |
| 561 } | 579 } |
| 562 | 580 |
| 563 @DomName('IDBFactory.webkitGetDatabaseNames') | 581 @DomName('IDBFactory.webkitGetDatabaseNames') |
| 564 @DocsEditable() | 582 @DocsEditable() |
| 565 @SupportedBrowser(SupportedBrowser.CHROME) | 583 @SupportedBrowser(SupportedBrowser.CHROME) |
| 566 @SupportedBrowser(SupportedBrowser.SAFARI) | 584 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 567 @Experimental() | 585 @Experimental() |
| 568 Request _webkitGetDatabaseNames() => _blink.BlinkIDBFactory.instance.webkitGet
DatabaseNames_Callback_0_(this); | 586 Request _webkitGetDatabaseNames() => |
| 569 | 587 _blink.BlinkIDBFactory.instance.webkitGetDatabaseNames_Callback_0_(this); |
| 570 } | 588 } |
| 571 | 589 |
| 572 | |
| 573 /** | 590 /** |
| 574 * Ties a request to a completer, so the completer is completed when it succeeds | 591 * Ties a request to a completer, so the completer is completed when it succeeds |
| 575 * and errors out when the request errors. | 592 * and errors out when the request errors. |
| 576 */ | 593 */ |
| 577 Future/*<T>*/ _completeRequest/*<T>*/(Request request) { | 594 Future/*<T>*/ _completeRequest/*<T>*/(Request request) { |
| 578 var completer = new Completer/*<T>*/.sync(); | 595 var completer = new Completer/*<T>*/ .sync(); |
| 579 // TODO: make sure that completer.complete is synchronous as transactions | 596 // TODO: make sure that completer.complete is synchronous as transactions |
| 580 // may be committed if the result is not processed immediately. | 597 // may be committed if the result is not processed immediately. |
| 581 request.onSuccess.listen((e) { | 598 request.onSuccess.listen((e) { |
| 582 var result = _cast/*<T>*/(request.result); | 599 var result = _cast/*<T>*/(request.result); |
| 583 completer.complete(result); | 600 completer.complete(result); |
| 584 }); | 601 }); |
| 585 request.onError.listen(completer.completeError); | 602 request.onError.listen(completer.completeError); |
| 586 return completer.future; | 603 return completer.future; |
| 587 } | 604 } |
| 588 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 605 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 589 // for details. All rights reserved. Use of this source code is governed by a | 606 // for details. All rights reserved. Use of this source code is governed by a |
| 590 // BSD-style license that can be found in the LICENSE file. | 607 // BSD-style license that can be found in the LICENSE file. |
| 591 | 608 |
| 592 | |
| 593 @DomName('IDBIndex') | 609 @DomName('IDBIndex') |
| 594 @Unstable() | 610 @Unstable() |
| 595 class Index extends DartHtmlDomObject { | 611 class Index extends DartHtmlDomObject { |
| 596 @DomName('IDBIndex.count') | 612 @DomName('IDBIndex.count') |
| 597 Future<int> count([key_OR_range]) { | 613 Future<int> count([key_OR_range]) { |
| 598 try { | 614 try { |
| 599 var request = _count(key_OR_range); | 615 var request = _count(key_OR_range); |
| 600 return _completeRequest(request); | 616 return _completeRequest(request); |
| 601 } catch (e, stacktrace) { | 617 } catch (e, stacktrace) { |
| 602 return new Future.error(e, stacktrace); | 618 return new Future.error(e, stacktrace); |
| 603 } | 619 } |
| 604 } | 620 } |
| 605 | 621 |
| 606 @DomName('IDBIndex.get') | 622 @DomName('IDBIndex.get') |
| 607 Future get(key) { | 623 Future get(key) { |
| 608 try { | 624 try { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 625 } | 641 } |
| 626 } | 642 } |
| 627 | 643 |
| 628 /** | 644 /** |
| 629 * Creates a stream of cursors over the records in this object store. | 645 * Creates a stream of cursors over the records in this object store. |
| 630 * | 646 * |
| 631 * See also: | 647 * See also: |
| 632 * | 648 * |
| 633 * * [ObjectStore.openCursor] | 649 * * [ObjectStore.openCursor] |
| 634 */ | 650 */ |
| 635 Stream<CursorWithValue> openCursor({key, KeyRange range, String direction, | 651 Stream<CursorWithValue> openCursor( |
| 636 bool autoAdvance}) { | 652 {key, KeyRange range, String direction, bool autoAdvance}) { |
| 637 var key_OR_range = null; | 653 var key_OR_range = null; |
| 638 if (key != null) { | 654 if (key != null) { |
| 639 if (range != null) { | 655 if (range != null) { |
| 640 throw new ArgumentError('Cannot specify both key and range.'); | 656 throw new ArgumentError('Cannot specify both key and range.'); |
| 641 } | 657 } |
| 642 key_OR_range = key; | 658 key_OR_range = key; |
| 643 } else { | 659 } else { |
| 644 key_OR_range = range; | 660 key_OR_range = range; |
| 645 } | 661 } |
| 646 var request; | 662 var request; |
| 647 if (direction == null) { | 663 if (direction == null) { |
| 648 // FIXME: Passing in "next" should be unnecessary. | 664 // FIXME: Passing in "next" should be unnecessary. |
| 649 request = _openCursor(key_OR_range, "next"); | 665 request = _openCursor(key_OR_range, "next"); |
| 650 } else { | 666 } else { |
| 651 request = _openCursor(key_OR_range, direction); | 667 request = _openCursor(key_OR_range, direction); |
| 652 } | 668 } |
| 653 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 669 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 654 } | 670 } |
| 655 | 671 |
| 656 /** | 672 /** |
| 657 * Creates a stream of cursors over the records in this object store. | 673 * Creates a stream of cursors over the records in this object store. |
| 658 * | 674 * |
| 659 * See also: | 675 * See also: |
| 660 * | 676 * |
| 661 * * [ObjectStore.openCursor] | 677 * * [ObjectStore.openCursor] |
| 662 */ | 678 */ |
| 663 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, | 679 Stream<Cursor> openKeyCursor( |
| 664 bool autoAdvance}) { | 680 {key, KeyRange range, String direction, bool autoAdvance}) { |
| 665 var key_OR_range = null; | 681 var key_OR_range = null; |
| 666 if (key != null) { | 682 if (key != null) { |
| 667 if (range != null) { | 683 if (range != null) { |
| 668 throw new ArgumentError('Cannot specify both key and range.'); | 684 throw new ArgumentError('Cannot specify both key and range.'); |
| 669 } | 685 } |
| 670 key_OR_range = key; | 686 key_OR_range = key; |
| 671 } else { | 687 } else { |
| 672 key_OR_range = range; | 688 key_OR_range = range; |
| 673 } | 689 } |
| 674 var request; | 690 var request; |
| 675 if (direction == null) { | 691 if (direction == null) { |
| 676 // FIXME: Passing in "next" should be unnecessary. | 692 // FIXME: Passing in "next" should be unnecessary. |
| 677 request = _openKeyCursor(key_OR_range, "next"); | 693 request = _openKeyCursor(key_OR_range, "next"); |
| 678 } else { | 694 } else { |
| 679 request = _openKeyCursor(key_OR_range, direction); | 695 request = _openKeyCursor(key_OR_range, direction); |
| 680 } | 696 } |
| 681 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 697 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
| 682 } | 698 } |
| 683 | 699 |
| 684 // To suppress missing implicit constructor warnings. | 700 // To suppress missing implicit constructor warnings. |
| 685 factory Index._() { throw new UnsupportedError("Not supported"); } | 701 factory Index._() { |
| 686 | 702 throw new UnsupportedError("Not supported"); |
| 703 } |
| 687 | 704 |
| 688 @Deprecated("Internal Use Only") | 705 @Deprecated("Internal Use Only") |
| 689 external static Type get instanceRuntimeType; | 706 external static Type get instanceRuntimeType; |
| 690 | 707 |
| 691 @Deprecated("Internal Use Only") | 708 @Deprecated("Internal Use Only") |
| 692 Index.internal_() { } | 709 Index.internal_() {} |
| 693 | 710 |
| 694 @DomName('IDBIndex.keyPath') | 711 @DomName('IDBIndex.keyPath') |
| 695 @DocsEditable() | 712 @DocsEditable() |
| 696 Object get keyPath => (_blink.BlinkIDBIndex.instance.keyPath_Getter_(this)); | 713 Object get keyPath => (_blink.BlinkIDBIndex.instance.keyPath_Getter_(this)); |
| 697 | 714 |
| 698 @DomName('IDBIndex.multiEntry') | 715 @DomName('IDBIndex.multiEntry') |
| 699 @DocsEditable() | 716 @DocsEditable() |
| 700 bool get multiEntry => _blink.BlinkIDBIndex.instance.multiEntry_Getter_(this); | 717 bool get multiEntry => _blink.BlinkIDBIndex.instance.multiEntry_Getter_(this); |
| 701 | 718 |
| 702 @DomName('IDBIndex.name') | 719 @DomName('IDBIndex.name') |
| 703 @DocsEditable() | 720 @DocsEditable() |
| 704 String get name => _blink.BlinkIDBIndex.instance.name_Getter_(this); | 721 String get name => _blink.BlinkIDBIndex.instance.name_Getter_(this); |
| 705 | 722 |
| 706 @DomName('IDBIndex.objectStore') | 723 @DomName('IDBIndex.objectStore') |
| 707 @DocsEditable() | 724 @DocsEditable() |
| 708 ObjectStore get objectStore => _blink.BlinkIDBIndex.instance.objectStore_Gette
r_(this); | 725 ObjectStore get objectStore => |
| 709 | 726 _blink.BlinkIDBIndex.instance.objectStore_Getter_(this); |
| 727 |
| 710 @DomName('IDBIndex.unique') | 728 @DomName('IDBIndex.unique') |
| 711 @DocsEditable() | 729 @DocsEditable() |
| 712 bool get unique => _blink.BlinkIDBIndex.instance.unique_Getter_(this); | 730 bool get unique => _blink.BlinkIDBIndex.instance.unique_Getter_(this); |
| 713 | 731 |
| 714 @DomName('IDBIndex.count') | 732 @DomName('IDBIndex.count') |
| 715 @DocsEditable() | 733 @DocsEditable() |
| 716 Request _count(Object key) => _blink.BlinkIDBIndex.instance.count_Callback_1_(
this, key); | 734 Request _count(Object key) => |
| 717 | 735 _blink.BlinkIDBIndex.instance.count_Callback_1_(this, key); |
| 736 |
| 718 @DomName('IDBIndex.get') | 737 @DomName('IDBIndex.get') |
| 719 @DocsEditable() | 738 @DocsEditable() |
| 720 Request _get(Object key) => _blink.BlinkIDBIndex.instance.get_Callback_1_(this
, key); | 739 Request _get(Object key) => |
| 721 | 740 _blink.BlinkIDBIndex.instance.get_Callback_1_(this, key); |
| 741 |
| 722 Request getAll(Object range, [int maxCount]) { | 742 Request getAll(Object range, [int maxCount]) { |
| 723 if (maxCount != null) { | 743 if (maxCount != null) { |
| 724 return _blink.BlinkIDBIndex.instance.getAll_Callback_2_(this, range, maxCo
unt); | 744 return _blink.BlinkIDBIndex.instance |
| 745 .getAll_Callback_2_(this, range, maxCount); |
| 725 } | 746 } |
| 726 return _blink.BlinkIDBIndex.instance.getAll_Callback_1_(this, range); | 747 return _blink.BlinkIDBIndex.instance.getAll_Callback_1_(this, range); |
| 727 } | 748 } |
| 728 | 749 |
| 729 Request getAllKeys(Object range, [int maxCount]) { | 750 Request getAllKeys(Object range, [int maxCount]) { |
| 730 if (maxCount != null) { | 751 if (maxCount != null) { |
| 731 return _blink.BlinkIDBIndex.instance.getAllKeys_Callback_2_(this, range, m
axCount); | 752 return _blink.BlinkIDBIndex.instance |
| 753 .getAllKeys_Callback_2_(this, range, maxCount); |
| 732 } | 754 } |
| 733 return _blink.BlinkIDBIndex.instance.getAllKeys_Callback_1_(this, range); | 755 return _blink.BlinkIDBIndex.instance.getAllKeys_Callback_1_(this, range); |
| 734 } | 756 } |
| 735 | 757 |
| 736 @DomName('IDBIndex.getKey') | 758 @DomName('IDBIndex.getKey') |
| 737 @DocsEditable() | 759 @DocsEditable() |
| 738 Request _getKey(Object key) => _blink.BlinkIDBIndex.instance.getKey_Callback_1
_(this, key); | 760 Request _getKey(Object key) => |
| 739 | 761 _blink.BlinkIDBIndex.instance.getKey_Callback_1_(this, key); |
| 762 |
| 740 Request _openCursor(Object range, [String direction]) { | 763 Request _openCursor(Object range, [String direction]) { |
| 741 if (direction != null) { | 764 if (direction != null) { |
| 742 return _blink.BlinkIDBIndex.instance.openCursor_Callback_2_(this, range, d
irection); | 765 return _blink.BlinkIDBIndex.instance |
| 766 .openCursor_Callback_2_(this, range, direction); |
| 743 } | 767 } |
| 744 return _blink.BlinkIDBIndex.instance.openCursor_Callback_1_(this, range); | 768 return _blink.BlinkIDBIndex.instance.openCursor_Callback_1_(this, range); |
| 745 } | 769 } |
| 746 | 770 |
| 747 Request _openKeyCursor(Object range, [String direction]) { | 771 Request _openKeyCursor(Object range, [String direction]) { |
| 748 if (direction != null) { | 772 if (direction != null) { |
| 749 return _blink.BlinkIDBIndex.instance.openKeyCursor_Callback_2_(this, range
, direction); | 773 return _blink.BlinkIDBIndex.instance |
| 774 .openKeyCursor_Callback_2_(this, range, direction); |
| 750 } | 775 } |
| 751 return _blink.BlinkIDBIndex.instance.openKeyCursor_Callback_1_(this, range); | 776 return _blink.BlinkIDBIndex.instance.openKeyCursor_Callback_1_(this, range); |
| 752 } | 777 } |
| 753 | |
| 754 } | 778 } |
| 755 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 779 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 756 // for details. All rights reserved. Use of this source code is governed by a | 780 // for details. All rights reserved. Use of this source code is governed by a |
| 757 // BSD-style license that can be found in the LICENSE file. | 781 // BSD-style license that can be found in the LICENSE file. |
| 758 | 782 |
| 759 | |
| 760 @DomName('IDBKeyRange') | 783 @DomName('IDBKeyRange') |
| 761 @Unstable() | 784 @Unstable() |
| 762 class KeyRange extends DartHtmlDomObject { | 785 class KeyRange extends DartHtmlDomObject { |
| 763 @DomName('IDBKeyRange.only') | 786 @DomName('IDBKeyRange.only') |
| 764 factory KeyRange.only(/*Key*/ value) => | 787 factory KeyRange.only(/*Key*/ value) => |
| 765 _KeyRangeFactoryProvider.createKeyRange_only(value); | 788 _KeyRangeFactoryProvider.createKeyRange_only(value); |
| 766 | 789 |
| 767 @DomName('IDBKeyRange.lowerBound') | 790 @DomName('IDBKeyRange.lowerBound') |
| 768 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => | 791 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => |
| 769 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); | 792 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); |
| 770 | 793 |
| 771 @DomName('IDBKeyRange.upperBound') | 794 @DomName('IDBKeyRange.upperBound') |
| 772 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => | 795 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => |
| 773 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); | 796 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); |
| 774 | 797 |
| 775 @DomName('KeyRange.bound') | 798 @DomName('KeyRange.bound') |
| 776 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, | 799 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, |
| 777 [bool lowerOpen = false, bool upperOpen = false]) => | 800 [bool lowerOpen = false, bool upperOpen = false]) => |
| 778 _KeyRangeFactoryProvider.createKeyRange_bound( | 801 _KeyRangeFactoryProvider.createKeyRange_bound( |
| 779 lower, upper, lowerOpen, upperOpen); | 802 lower, upper, lowerOpen, upperOpen); |
| 780 | 803 |
| 781 // To suppress missing implicit constructor warnings. | 804 // To suppress missing implicit constructor warnings. |
| 782 factory KeyRange._() { throw new UnsupportedError("Not supported"); } | 805 factory KeyRange._() { |
| 783 | 806 throw new UnsupportedError("Not supported"); |
| 807 } |
| 784 | 808 |
| 785 @Deprecated("Internal Use Only") | 809 @Deprecated("Internal Use Only") |
| 786 external static Type get instanceRuntimeType; | 810 external static Type get instanceRuntimeType; |
| 787 | 811 |
| 788 @Deprecated("Internal Use Only") | 812 @Deprecated("Internal Use Only") |
| 789 KeyRange.internal_() { } | 813 KeyRange.internal_() {} |
| 790 | 814 |
| 791 @DomName('IDBKeyRange.lower') | 815 @DomName('IDBKeyRange.lower') |
| 792 @DocsEditable() | 816 @DocsEditable() |
| 793 Object get lower => (_blink.BlinkIDBKeyRange.instance.lower_Getter_(this)); | 817 Object get lower => (_blink.BlinkIDBKeyRange.instance.lower_Getter_(this)); |
| 794 | 818 |
| 795 @DomName('IDBKeyRange.lowerOpen') | 819 @DomName('IDBKeyRange.lowerOpen') |
| 796 @DocsEditable() | 820 @DocsEditable() |
| 797 bool get lowerOpen => _blink.BlinkIDBKeyRange.instance.lowerOpen_Getter_(this)
; | 821 bool get lowerOpen => |
| 798 | 822 _blink.BlinkIDBKeyRange.instance.lowerOpen_Getter_(this); |
| 823 |
| 799 @DomName('IDBKeyRange.upper') | 824 @DomName('IDBKeyRange.upper') |
| 800 @DocsEditable() | 825 @DocsEditable() |
| 801 Object get upper => (_blink.BlinkIDBKeyRange.instance.upper_Getter_(this)); | 826 Object get upper => (_blink.BlinkIDBKeyRange.instance.upper_Getter_(this)); |
| 802 | 827 |
| 803 @DomName('IDBKeyRange.upperOpen') | 828 @DomName('IDBKeyRange.upperOpen') |
| 804 @DocsEditable() | 829 @DocsEditable() |
| 805 bool get upperOpen => _blink.BlinkIDBKeyRange.instance.upperOpen_Getter_(this)
; | 830 bool get upperOpen => |
| 806 | 831 _blink.BlinkIDBKeyRange.instance.upperOpen_Getter_(this); |
| 807 static KeyRange bound_(Object lower, Object upper, [bool lowerOpen, bool upper
Open]) { | 832 |
| 833 static KeyRange bound_(Object lower, Object upper, |
| 834 [bool lowerOpen, bool upperOpen]) { |
| 808 if (upperOpen != null) { | 835 if (upperOpen != null) { |
| 809 return _blink.BlinkIDBKeyRange.instance.bound_Callback_4_(lower, upper, lo
werOpen, upperOpen); | 836 return _blink.BlinkIDBKeyRange.instance |
| 837 .bound_Callback_4_(lower, upper, lowerOpen, upperOpen); |
| 810 } | 838 } |
| 811 if (lowerOpen != null) { | 839 if (lowerOpen != null) { |
| 812 return _blink.BlinkIDBKeyRange.instance.bound_Callback_3_(lower, upper, lo
werOpen); | 840 return _blink.BlinkIDBKeyRange.instance |
| 841 .bound_Callback_3_(lower, upper, lowerOpen); |
| 813 } | 842 } |
| 814 return _blink.BlinkIDBKeyRange.instance.bound_Callback_2_(lower, upper); | 843 return _blink.BlinkIDBKeyRange.instance.bound_Callback_2_(lower, upper); |
| 815 } | 844 } |
| 816 | 845 |
| 817 static KeyRange lowerBound_(Object bound, [bool open]) { | 846 static KeyRange lowerBound_(Object bound, [bool open]) { |
| 818 if (open != null) { | 847 if (open != null) { |
| 819 return _blink.BlinkIDBKeyRange.instance.lowerBound_Callback_2_(bound, open
); | 848 return _blink.BlinkIDBKeyRange.instance |
| 849 .lowerBound_Callback_2_(bound, open); |
| 820 } | 850 } |
| 821 return _blink.BlinkIDBKeyRange.instance.lowerBound_Callback_1_(bound); | 851 return _blink.BlinkIDBKeyRange.instance.lowerBound_Callback_1_(bound); |
| 822 } | 852 } |
| 823 | 853 |
| 824 @DomName('IDBKeyRange.only_') | 854 @DomName('IDBKeyRange.only_') |
| 825 @DocsEditable() | 855 @DocsEditable() |
| 826 @Experimental() // non-standard | 856 @Experimental() // non-standard |
| 827 static KeyRange only_(Object value) => _blink.BlinkIDBKeyRange.instance.only_C
allback_1_(value); | 857 static KeyRange only_(Object value) => |
| 828 | 858 _blink.BlinkIDBKeyRange.instance.only_Callback_1_(value); |
| 859 |
| 829 static KeyRange upperBound_(Object bound, [bool open]) { | 860 static KeyRange upperBound_(Object bound, [bool open]) { |
| 830 if (open != null) { | 861 if (open != null) { |
| 831 return _blink.BlinkIDBKeyRange.instance.upperBound_Callback_2_(bound, open
); | 862 return _blink.BlinkIDBKeyRange.instance |
| 863 .upperBound_Callback_2_(bound, open); |
| 832 } | 864 } |
| 833 return _blink.BlinkIDBKeyRange.instance.upperBound_Callback_1_(bound); | 865 return _blink.BlinkIDBKeyRange.instance.upperBound_Callback_1_(bound); |
| 834 } | 866 } |
| 835 | |
| 836 } | 867 } |
| 837 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 868 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 838 // for details. All rights reserved. Use of this source code is governed by a | 869 // for details. All rights reserved. Use of this source code is governed by a |
| 839 // BSD-style license that can be found in the LICENSE file. | 870 // BSD-style license that can be found in the LICENSE file. |
| 840 | 871 |
| 841 | |
| 842 @DomName('IDBObjectStore') | 872 @DomName('IDBObjectStore') |
| 843 @Unstable() | 873 @Unstable() |
| 844 class ObjectStore extends DartHtmlDomObject { | 874 class ObjectStore extends DartHtmlDomObject { |
| 845 | |
| 846 @DomName('IDBObjectStore.add') | 875 @DomName('IDBObjectStore.add') |
| 847 Future add(value, [key]) { | 876 Future add(value, [key]) { |
| 848 try { | 877 try { |
| 849 var request; | 878 var request; |
| 850 if (key != null) { | 879 if (key != null) { |
| 851 request = _add(value, key); | 880 request = _add(value, key); |
| 852 } else { | 881 } else { |
| 853 request = _add(value); | 882 request = _add(value); |
| 854 } | 883 } |
| 855 return _completeRequest(request); | 884 return _completeRequest(request); |
| 856 } catch (e, stacktrace) { | 885 } catch (e, stacktrace) { |
| 857 return new Future.error(e, stacktrace); | 886 return new Future.error(e, stacktrace); |
| 858 } | 887 } |
| 859 } | 888 } |
| 860 | 889 |
| 861 @DomName('IDBObjectStore.clear') | 890 @DomName('IDBObjectStore.clear') |
| 862 Future clear() { | 891 Future clear() { |
| 863 try { | 892 try { |
| 864 return _completeRequest(_clear()); | 893 return _completeRequest(_clear()); |
| 865 } catch (e, stacktrace) { | 894 } catch (e, stacktrace) { |
| 866 return new Future.error(e, stacktrace); | 895 return new Future.error(e, stacktrace); |
| 867 } | 896 } |
| 868 } | 897 } |
| 869 | 898 |
| 870 @DomName('IDBObjectStore.delete') | 899 @DomName('IDBObjectStore.delete') |
| 871 Future delete(key_OR_keyRange){ | 900 Future delete(key_OR_keyRange) { |
| 872 try { | 901 try { |
| 873 return _completeRequest(_delete(key_OR_keyRange)); | 902 return _completeRequest(_delete(key_OR_keyRange)); |
| 874 } catch (e, stacktrace) { | 903 } catch (e, stacktrace) { |
| 875 return new Future.error(e, stacktrace); | 904 return new Future.error(e, stacktrace); |
| 876 } | 905 } |
| 877 } | 906 } |
| 878 | 907 |
| 879 @DomName('IDBObjectStore.count') | 908 @DomName('IDBObjectStore.count') |
| 880 Future<int> count([key_OR_range]) { | 909 Future<int> count([key_OR_range]) { |
| 881 try { | 910 try { |
| 882 var request = _count(key_OR_range); | 911 var request = _count(key_OR_range); |
| 883 return _completeRequest(request); | 912 return _completeRequest(request); |
| 884 } catch (e, stacktrace) { | 913 } catch (e, stacktrace) { |
| 885 return new Future.error(e, stacktrace); | 914 return new Future.error(e, stacktrace); |
| 886 } | 915 } |
| 887 } | 916 } |
| 888 | 917 |
| 889 @DomName('IDBObjectStore.put') | 918 @DomName('IDBObjectStore.put') |
| 890 Future put(value, [key]) { | 919 Future put(value, [key]) { |
| 891 try { | 920 try { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 * // called when there are no more cursors. | 956 * // called when there are no more cursors. |
| 928 * print('all done!'); | 957 * print('all done!'); |
| 929 * }); | 958 * }); |
| 930 * | 959 * |
| 931 * Asynchronous operations which are not related to the current transaction | 960 * Asynchronous operations which are not related to the current transaction |
| 932 * will cause the transaction to automatically be committed-- all processing | 961 * will cause the transaction to automatically be committed-- all processing |
| 933 * must be done synchronously unless they are additional async requests to | 962 * must be done synchronously unless they are additional async requests to |
| 934 * the current transaction. | 963 * the current transaction. |
| 935 */ | 964 */ |
| 936 @DomName('IDBObjectStore.openCursor') | 965 @DomName('IDBObjectStore.openCursor') |
| 937 Stream<CursorWithValue> openCursor({key, KeyRange range, String direction, | 966 Stream<CursorWithValue> openCursor( |
| 938 bool autoAdvance}) { | 967 {key, KeyRange range, String direction, bool autoAdvance}) { |
| 939 var key_OR_range = null; | 968 var key_OR_range = null; |
| 940 if (key != null) { | 969 if (key != null) { |
| 941 if (range != null) { | 970 if (range != null) { |
| 942 throw new ArgumentError('Cannot specify both key and range.'); | 971 throw new ArgumentError('Cannot specify both key and range.'); |
| 943 } | 972 } |
| 944 key_OR_range = key; | 973 key_OR_range = key; |
| 945 } else { | 974 } else { |
| 946 key_OR_range = range; | 975 key_OR_range = range; |
| 947 } | 976 } |
| 948 | 977 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 963 options['unique'] = unique; | 992 options['unique'] = unique; |
| 964 } | 993 } |
| 965 if (multiEntry != null) { | 994 if (multiEntry != null) { |
| 966 options['multiEntry'] = multiEntry; | 995 options['multiEntry'] = multiEntry; |
| 967 } | 996 } |
| 968 | 997 |
| 969 return _createIndex(name, keyPath, options); | 998 return _createIndex(name, keyPath, options); |
| 970 } | 999 } |
| 971 | 1000 |
| 972 // To suppress missing implicit constructor warnings. | 1001 // To suppress missing implicit constructor warnings. |
| 973 factory ObjectStore._() { throw new UnsupportedError("Not supported"); } | 1002 factory ObjectStore._() { |
| 974 | 1003 throw new UnsupportedError("Not supported"); |
| 1004 } |
| 975 | 1005 |
| 976 @Deprecated("Internal Use Only") | 1006 @Deprecated("Internal Use Only") |
| 977 external static Type get instanceRuntimeType; | 1007 external static Type get instanceRuntimeType; |
| 978 | 1008 |
| 979 @Deprecated("Internal Use Only") | 1009 @Deprecated("Internal Use Only") |
| 980 ObjectStore.internal_() { } | 1010 ObjectStore.internal_() {} |
| 981 | 1011 |
| 982 @DomName('IDBObjectStore.autoIncrement') | 1012 @DomName('IDBObjectStore.autoIncrement') |
| 983 @DocsEditable() | 1013 @DocsEditable() |
| 984 bool get autoIncrement => _blink.BlinkIDBObjectStore.instance.autoIncrement_Ge
tter_(this); | 1014 bool get autoIncrement => |
| 985 | 1015 _blink.BlinkIDBObjectStore.instance.autoIncrement_Getter_(this); |
| 1016 |
| 986 @DomName('IDBObjectStore.indexNames') | 1017 @DomName('IDBObjectStore.indexNames') |
| 987 @DocsEditable() | 1018 @DocsEditable() |
| 988 List<String> get indexNames => _blink.BlinkIDBObjectStore.instance.indexNames_
Getter_(this); | 1019 List<String> get indexNames => |
| 989 | 1020 _blink.BlinkIDBObjectStore.instance.indexNames_Getter_(this); |
| 1021 |
| 990 @DomName('IDBObjectStore.keyPath') | 1022 @DomName('IDBObjectStore.keyPath') |
| 991 @DocsEditable() | 1023 @DocsEditable() |
| 992 Object get keyPath => (_blink.BlinkIDBObjectStore.instance.keyPath_Getter_(thi
s)); | 1024 Object get keyPath => |
| 993 | 1025 (_blink.BlinkIDBObjectStore.instance.keyPath_Getter_(this)); |
| 1026 |
| 994 @DomName('IDBObjectStore.name') | 1027 @DomName('IDBObjectStore.name') |
| 995 @DocsEditable() | 1028 @DocsEditable() |
| 996 String get name => _blink.BlinkIDBObjectStore.instance.name_Getter_(this); | 1029 String get name => _blink.BlinkIDBObjectStore.instance.name_Getter_(this); |
| 997 | 1030 |
| 998 @DomName('IDBObjectStore.transaction') | 1031 @DomName('IDBObjectStore.transaction') |
| 999 @DocsEditable() | 1032 @DocsEditable() |
| 1000 Transaction get transaction => _blink.BlinkIDBObjectStore.instance.transaction
_Getter_(this); | 1033 Transaction get transaction => |
| 1001 | 1034 _blink.BlinkIDBObjectStore.instance.transaction_Getter_(this); |
| 1035 |
| 1002 Request _add(Object value, [Object key]) { | 1036 Request _add(Object value, [Object key]) { |
| 1003 if (key != null) { | 1037 if (key != null) { |
| 1004 return _blink.BlinkIDBObjectStore.instance.add_Callback_2_(this, convertDa
rtToNative_SerializedScriptValue(value), convertDartToNative_SerializedScriptVal
ue(key)); | 1038 return _blink.BlinkIDBObjectStore.instance.add_Callback_2_( |
| 1039 this, |
| 1040 convertDartToNative_SerializedScriptValue(value), |
| 1041 convertDartToNative_SerializedScriptValue(key)); |
| 1005 } | 1042 } |
| 1006 return _blink.BlinkIDBObjectStore.instance.add_Callback_1_(this, convertDart
ToNative_SerializedScriptValue(value)); | 1043 return _blink.BlinkIDBObjectStore.instance.add_Callback_1_( |
| 1044 this, convertDartToNative_SerializedScriptValue(value)); |
| 1007 } | 1045 } |
| 1008 | 1046 |
| 1009 @DomName('IDBObjectStore.clear') | 1047 @DomName('IDBObjectStore.clear') |
| 1010 @DocsEditable() | 1048 @DocsEditable() |
| 1011 Request _clear() => _blink.BlinkIDBObjectStore.instance.clear_Callback_0_(this
); | 1049 Request _clear() => |
| 1012 | 1050 _blink.BlinkIDBObjectStore.instance.clear_Callback_0_(this); |
| 1051 |
| 1013 @DomName('IDBObjectStore.count') | 1052 @DomName('IDBObjectStore.count') |
| 1014 @DocsEditable() | 1053 @DocsEditable() |
| 1015 Request _count(Object key) => _blink.BlinkIDBObjectStore.instance.count_Callba
ck_1_(this, key); | 1054 Request _count(Object key) => |
| 1016 | 1055 _blink.BlinkIDBObjectStore.instance.count_Callback_1_(this, key); |
| 1056 |
| 1017 Index _createIndex(String name, Object keyPath, [Map options]) { | 1057 Index _createIndex(String name, Object keyPath, [Map options]) { |
| 1018 if (options != null) { | 1058 if (options != null) { |
| 1019 return _blink.BlinkIDBObjectStore.instance.createIndex_Callback_3_(this, n
ame, keyPath, convertDartToNative_Dictionary(options)); | 1059 return _blink.BlinkIDBObjectStore.instance.createIndex_Callback_3_( |
| 1060 this, name, keyPath, convertDartToNative_Dictionary(options)); |
| 1020 } | 1061 } |
| 1021 return _blink.BlinkIDBObjectStore.instance.createIndex_Callback_2_(this, nam
e, keyPath); | 1062 return _blink.BlinkIDBObjectStore.instance |
| 1063 .createIndex_Callback_2_(this, name, keyPath); |
| 1022 } | 1064 } |
| 1023 | 1065 |
| 1024 @DomName('IDBObjectStore.delete') | 1066 @DomName('IDBObjectStore.delete') |
| 1025 @DocsEditable() | 1067 @DocsEditable() |
| 1026 Request _delete(Object key) => _blink.BlinkIDBObjectStore.instance.delete_Call
back_1_(this, key); | 1068 Request _delete(Object key) => |
| 1027 | 1069 _blink.BlinkIDBObjectStore.instance.delete_Callback_1_(this, key); |
| 1070 |
| 1028 @DomName('IDBObjectStore.deleteIndex') | 1071 @DomName('IDBObjectStore.deleteIndex') |
| 1029 @DocsEditable() | 1072 @DocsEditable() |
| 1030 void deleteIndex(String name) => _blink.BlinkIDBObjectStore.instance.deleteInd
ex_Callback_1_(this, name); | 1073 void deleteIndex(String name) => |
| 1031 | 1074 _blink.BlinkIDBObjectStore.instance.deleteIndex_Callback_1_(this, name); |
| 1075 |
| 1032 @DomName('IDBObjectStore.get') | 1076 @DomName('IDBObjectStore.get') |
| 1033 @DocsEditable() | 1077 @DocsEditable() |
| 1034 Request _get(Object key) => _blink.BlinkIDBObjectStore.instance.get_Callback_1
_(this, key); | 1078 Request _get(Object key) => |
| 1035 | 1079 _blink.BlinkIDBObjectStore.instance.get_Callback_1_(this, key); |
| 1080 |
| 1036 Request getAll(Object range, [int maxCount]) { | 1081 Request getAll(Object range, [int maxCount]) { |
| 1037 if (maxCount != null) { | 1082 if (maxCount != null) { |
| 1038 return _blink.BlinkIDBObjectStore.instance.getAll_Callback_2_(this, range,
maxCount); | 1083 return _blink.BlinkIDBObjectStore.instance |
| 1084 .getAll_Callback_2_(this, range, maxCount); |
| 1039 } | 1085 } |
| 1040 return _blink.BlinkIDBObjectStore.instance.getAll_Callback_1_(this, range); | 1086 return _blink.BlinkIDBObjectStore.instance.getAll_Callback_1_(this, range); |
| 1041 } | 1087 } |
| 1042 | 1088 |
| 1043 Request getAllKeys(Object range, [int maxCount]) { | 1089 Request getAllKeys(Object range, [int maxCount]) { |
| 1044 if (maxCount != null) { | 1090 if (maxCount != null) { |
| 1045 return _blink.BlinkIDBObjectStore.instance.getAllKeys_Callback_2_(this, ra
nge, maxCount); | 1091 return _blink.BlinkIDBObjectStore.instance |
| 1092 .getAllKeys_Callback_2_(this, range, maxCount); |
| 1046 } | 1093 } |
| 1047 return _blink.BlinkIDBObjectStore.instance.getAllKeys_Callback_1_(this, rang
e); | 1094 return _blink.BlinkIDBObjectStore.instance |
| 1095 .getAllKeys_Callback_1_(this, range); |
| 1048 } | 1096 } |
| 1049 | 1097 |
| 1050 @DomName('IDBObjectStore.index') | 1098 @DomName('IDBObjectStore.index') |
| 1051 @DocsEditable() | 1099 @DocsEditable() |
| 1052 Index index(String name) => _blink.BlinkIDBObjectStore.instance.index_Callback
_1_(this, name); | 1100 Index index(String name) => |
| 1053 | 1101 _blink.BlinkIDBObjectStore.instance.index_Callback_1_(this, name); |
| 1102 |
| 1054 Request _openCursor(Object range, [String direction]) { | 1103 Request _openCursor(Object range, [String direction]) { |
| 1055 if (direction != null) { | 1104 if (direction != null) { |
| 1056 return _blink.BlinkIDBObjectStore.instance.openCursor_Callback_2_(this, ra
nge, direction); | 1105 return _blink.BlinkIDBObjectStore.instance |
| 1106 .openCursor_Callback_2_(this, range, direction); |
| 1057 } | 1107 } |
| 1058 return _blink.BlinkIDBObjectStore.instance.openCursor_Callback_1_(this, rang
e); | 1108 return _blink.BlinkIDBObjectStore.instance |
| 1109 .openCursor_Callback_1_(this, range); |
| 1059 } | 1110 } |
| 1060 | 1111 |
| 1061 Request openKeyCursor(Object range, [String direction]) { | 1112 Request openKeyCursor(Object range, [String direction]) { |
| 1062 if (direction != null) { | 1113 if (direction != null) { |
| 1063 return _blink.BlinkIDBObjectStore.instance.openKeyCursor_Callback_2_(this,
range, direction); | 1114 return _blink.BlinkIDBObjectStore.instance |
| 1115 .openKeyCursor_Callback_2_(this, range, direction); |
| 1064 } | 1116 } |
| 1065 return _blink.BlinkIDBObjectStore.instance.openKeyCursor_Callback_1_(this, r
ange); | 1117 return _blink.BlinkIDBObjectStore.instance |
| 1118 .openKeyCursor_Callback_1_(this, range); |
| 1066 } | 1119 } |
| 1067 | 1120 |
| 1068 Request _put(Object value, [Object key]) { | 1121 Request _put(Object value, [Object key]) { |
| 1069 if (key != null) { | 1122 if (key != null) { |
| 1070 return _blink.BlinkIDBObjectStore.instance.put_Callback_2_(this, convertDa
rtToNative_SerializedScriptValue(value), convertDartToNative_SerializedScriptVal
ue(key)); | 1123 return _blink.BlinkIDBObjectStore.instance.put_Callback_2_( |
| 1124 this, |
| 1125 convertDartToNative_SerializedScriptValue(value), |
| 1126 convertDartToNative_SerializedScriptValue(key)); |
| 1071 } | 1127 } |
| 1072 return _blink.BlinkIDBObjectStore.instance.put_Callback_1_(this, convertDart
ToNative_SerializedScriptValue(value)); | 1128 return _blink.BlinkIDBObjectStore.instance.put_Callback_1_( |
| 1129 this, convertDartToNative_SerializedScriptValue(value)); |
| 1073 } | 1130 } |
| 1074 | 1131 |
| 1075 | |
| 1076 /** | 1132 /** |
| 1077 * Helper for iterating over cursors in a request. | 1133 * Helper for iterating over cursors in a request. |
| 1078 */ | 1134 */ |
| 1079 static Stream/*<T>*/ _cursorStreamFromResult/*<T extends Cursor>*/(Request req
uest, | 1135 static Stream/*<T>*/ _cursorStreamFromResult/*<T extends Cursor>*/( |
| 1080 bool autoAdvance) { | 1136 Request request, bool autoAdvance) { |
| 1081 // TODO: need to guarantee that the controller provides the values | 1137 // TODO: need to guarantee that the controller provides the values |
| 1082 // immediately as waiting until the next tick will cause the transaction to | 1138 // immediately as waiting until the next tick will cause the transaction to |
| 1083 // close. | 1139 // close. |
| 1084 var controller = new StreamController/*<T>*/(sync: true); | 1140 var controller = new StreamController/*<T>*/(sync: true); |
| 1085 | 1141 |
| 1086 //TODO: Report stacktrace once issue 4061 is resolved. | 1142 //TODO: Report stacktrace once issue 4061 is resolved. |
| 1087 request.onError.listen(controller.addError); | 1143 request.onError.listen(controller.addError); |
| 1088 | 1144 |
| 1089 request.onSuccess.listen((e) { | 1145 request.onSuccess.listen((e) { |
| 1090 var cursor = _cast/*<T>*/(request.result); | 1146 var cursor = _cast/*<T>*/(request.result); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1102 } | 1158 } |
| 1103 | 1159 |
| 1104 // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE | 1160 // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE |
| 1105 /*=To*/ _cast/*<To>*/(dynamic x) => x; | 1161 /*=To*/ _cast/*<To>*/(dynamic x) => x; |
| 1106 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1162 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1107 // for details. All rights reserved. Use of this source code is governed by a | 1163 // for details. All rights reserved. Use of this source code is governed by a |
| 1108 // BSD-style license that can be found in the LICENSE file. | 1164 // BSD-style license that can be found in the LICENSE file. |
| 1109 | 1165 |
| 1110 // WARNING: Do not edit - generated code. | 1166 // WARNING: Do not edit - generated code. |
| 1111 | 1167 |
| 1112 | |
| 1113 @DocsEditable() | 1168 @DocsEditable() |
| 1114 @DomName('IDBOpenDBRequest') | 1169 @DomName('IDBOpenDBRequest') |
| 1115 @Unstable() | 1170 @Unstable() |
| 1116 class OpenDBRequest extends Request { | 1171 class OpenDBRequest extends Request { |
| 1117 // To suppress missing implicit constructor warnings. | 1172 // To suppress missing implicit constructor warnings. |
| 1118 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); } | 1173 factory OpenDBRequest._() { |
| 1174 throw new UnsupportedError("Not supported"); |
| 1175 } |
| 1119 | 1176 |
| 1120 /** | 1177 /** |
| 1121 * Static factory designed to expose `blocked` events to event | 1178 * Static factory designed to expose `blocked` events to event |
| 1122 * handlers that are not necessarily instances of [OpenDBRequest]. | 1179 * handlers that are not necessarily instances of [OpenDBRequest]. |
| 1123 * | 1180 * |
| 1124 * See [EventStreamProvider] for usage information. | 1181 * See [EventStreamProvider] for usage information. |
| 1125 */ | 1182 */ |
| 1126 @DomName('IDBOpenDBRequest.blockedEvent') | 1183 @DomName('IDBOpenDBRequest.blockedEvent') |
| 1127 @DocsEditable() | 1184 @DocsEditable() |
| 1128 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); | 1185 static const EventStreamProvider<Event> blockedEvent = |
| 1186 const EventStreamProvider<Event>('blocked'); |
| 1129 | 1187 |
| 1130 /** | 1188 /** |
| 1131 * Static factory designed to expose `upgradeneeded` events to event | 1189 * Static factory designed to expose `upgradeneeded` events to event |
| 1132 * handlers that are not necessarily instances of [OpenDBRequest]. | 1190 * handlers that are not necessarily instances of [OpenDBRequest]. |
| 1133 * | 1191 * |
| 1134 * See [EventStreamProvider] for usage information. | 1192 * See [EventStreamProvider] for usage information. |
| 1135 */ | 1193 */ |
| 1136 @DomName('IDBOpenDBRequest.upgradeneededEvent') | 1194 @DomName('IDBOpenDBRequest.upgradeneededEvent') |
| 1137 @DocsEditable() | 1195 @DocsEditable() |
| 1138 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); | 1196 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = |
| 1139 | 1197 const EventStreamProvider<VersionChangeEvent>('upgradeneeded'); |
| 1140 | 1198 |
| 1141 @Deprecated("Internal Use Only") | 1199 @Deprecated("Internal Use Only") |
| 1142 external static Type get instanceRuntimeType; | 1200 external static Type get instanceRuntimeType; |
| 1143 | 1201 |
| 1144 @Deprecated("Internal Use Only") | 1202 @Deprecated("Internal Use Only") |
| 1145 OpenDBRequest.internal_() : super.internal_(); | 1203 OpenDBRequest.internal_() : super.internal_(); |
| 1146 | 1204 |
| 1147 | |
| 1148 /// Stream of `blocked` events handled by this [OpenDBRequest]. | 1205 /// Stream of `blocked` events handled by this [OpenDBRequest]. |
| 1149 @DomName('IDBOpenDBRequest.onblocked') | 1206 @DomName('IDBOpenDBRequest.onblocked') |
| 1150 @DocsEditable() | 1207 @DocsEditable() |
| 1151 Stream<Event> get onBlocked => blockedEvent.forTarget(this); | 1208 Stream<Event> get onBlocked => blockedEvent.forTarget(this); |
| 1152 | 1209 |
| 1153 /// Stream of `upgradeneeded` events handled by this [OpenDBRequest]. | 1210 /// Stream of `upgradeneeded` events handled by this [OpenDBRequest]. |
| 1154 @DomName('IDBOpenDBRequest.onupgradeneeded') | 1211 @DomName('IDBOpenDBRequest.onupgradeneeded') |
| 1155 @DocsEditable() | 1212 @DocsEditable() |
| 1156 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); | 1213 Stream<VersionChangeEvent> get onUpgradeNeeded => |
| 1157 | 1214 upgradeNeededEvent.forTarget(this); |
| 1158 } | 1215 } |
| 1159 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1216 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1160 // for details. All rights reserved. Use of this source code is governed by a | 1217 // for details. All rights reserved. Use of this source code is governed by a |
| 1161 // BSD-style license that can be found in the LICENSE file. | 1218 // BSD-style license that can be found in the LICENSE file. |
| 1162 | 1219 |
| 1163 // WARNING: Do not edit - generated code. | 1220 // WARNING: Do not edit - generated code. |
| 1164 | 1221 |
| 1165 | |
| 1166 @DocsEditable() | 1222 @DocsEditable() |
| 1167 @DomName('IDBRequest') | 1223 @DomName('IDBRequest') |
| 1168 @Unstable() | 1224 @Unstable() |
| 1169 class Request extends EventTarget { | 1225 class Request extends EventTarget { |
| 1170 // To suppress missing implicit constructor warnings. | 1226 // To suppress missing implicit constructor warnings. |
| 1171 factory Request._() { throw new UnsupportedError("Not supported"); } | 1227 factory Request._() { |
| 1228 throw new UnsupportedError("Not supported"); |
| 1229 } |
| 1172 | 1230 |
| 1173 /** | 1231 /** |
| 1174 * Static factory designed to expose `error` events to event | 1232 * Static factory designed to expose `error` events to event |
| 1175 * handlers that are not necessarily instances of [Request]. | 1233 * handlers that are not necessarily instances of [Request]. |
| 1176 * | 1234 * |
| 1177 * See [EventStreamProvider] for usage information. | 1235 * See [EventStreamProvider] for usage information. |
| 1178 */ | 1236 */ |
| 1179 @DomName('IDBRequest.errorEvent') | 1237 @DomName('IDBRequest.errorEvent') |
| 1180 @DocsEditable() | 1238 @DocsEditable() |
| 1181 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1239 static const EventStreamProvider<Event> errorEvent = |
| 1240 const EventStreamProvider<Event>('error'); |
| 1182 | 1241 |
| 1183 /** | 1242 /** |
| 1184 * Static factory designed to expose `success` events to event | 1243 * Static factory designed to expose `success` events to event |
| 1185 * handlers that are not necessarily instances of [Request]. | 1244 * handlers that are not necessarily instances of [Request]. |
| 1186 * | 1245 * |
| 1187 * See [EventStreamProvider] for usage information. | 1246 * See [EventStreamProvider] for usage information. |
| 1188 */ | 1247 */ |
| 1189 @DomName('IDBRequest.successEvent') | 1248 @DomName('IDBRequest.successEvent') |
| 1190 @DocsEditable() | 1249 @DocsEditable() |
| 1191 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); | 1250 static const EventStreamProvider<Event> successEvent = |
| 1192 | 1251 const EventStreamProvider<Event>('success'); |
| 1193 | 1252 |
| 1194 @Deprecated("Internal Use Only") | 1253 @Deprecated("Internal Use Only") |
| 1195 external static Type get instanceRuntimeType; | 1254 external static Type get instanceRuntimeType; |
| 1196 | 1255 |
| 1197 @Deprecated("Internal Use Only") | 1256 @Deprecated("Internal Use Only") |
| 1198 Request.internal_() : super.internal_(); | 1257 Request.internal_() : super.internal_(); |
| 1199 | 1258 |
| 1200 | |
| 1201 @DomName('IDBRequest.error') | 1259 @DomName('IDBRequest.error') |
| 1202 @DocsEditable() | 1260 @DocsEditable() |
| 1203 DomError get error => _blink.BlinkIDBRequest.instance.error_Getter_(this); | 1261 DomError get error => _blink.BlinkIDBRequest.instance.error_Getter_(this); |
| 1204 | 1262 |
| 1205 @DomName('IDBRequest.readyState') | 1263 @DomName('IDBRequest.readyState') |
| 1206 @DocsEditable() | 1264 @DocsEditable() |
| 1207 String get readyState => _blink.BlinkIDBRequest.instance.readyState_Getter_(th
is); | 1265 String get readyState => |
| 1208 | 1266 _blink.BlinkIDBRequest.instance.readyState_Getter_(this); |
| 1267 |
| 1209 @DomName('IDBRequest.result') | 1268 @DomName('IDBRequest.result') |
| 1210 @DocsEditable() | 1269 @DocsEditable() |
| 1211 Object get result => _convertNativeToDart_IDBAny(_blink.BlinkIDBRequest.instan
ce.result_Getter_(this)); | 1270 Object get result => _convertNativeToDart_IDBAny( |
| 1212 | 1271 _blink.BlinkIDBRequest.instance.result_Getter_(this)); |
| 1272 |
| 1213 @DomName('IDBRequest.source') | 1273 @DomName('IDBRequest.source') |
| 1214 @DocsEditable() | 1274 @DocsEditable() |
| 1215 Object get source => (_blink.BlinkIDBRequest.instance.source_Getter_(this)); | 1275 Object get source => (_blink.BlinkIDBRequest.instance.source_Getter_(this)); |
| 1216 | 1276 |
| 1217 @DomName('IDBRequest.transaction') | 1277 @DomName('IDBRequest.transaction') |
| 1218 @DocsEditable() | 1278 @DocsEditable() |
| 1219 Transaction get transaction => _blink.BlinkIDBRequest.instance.transaction_Get
ter_(this); | 1279 Transaction get transaction => |
| 1220 | 1280 _blink.BlinkIDBRequest.instance.transaction_Getter_(this); |
| 1281 |
| 1221 /// Stream of `error` events handled by this [Request]. | 1282 /// Stream of `error` events handled by this [Request]. |
| 1222 @DomName('IDBRequest.onerror') | 1283 @DomName('IDBRequest.onerror') |
| 1223 @DocsEditable() | 1284 @DocsEditable() |
| 1224 Stream<Event> get onError => errorEvent.forTarget(this); | 1285 Stream<Event> get onError => errorEvent.forTarget(this); |
| 1225 | 1286 |
| 1226 /// Stream of `success` events handled by this [Request]. | 1287 /// Stream of `success` events handled by this [Request]. |
| 1227 @DomName('IDBRequest.onsuccess') | 1288 @DomName('IDBRequest.onsuccess') |
| 1228 @DocsEditable() | 1289 @DocsEditable() |
| 1229 Stream<Event> get onSuccess => successEvent.forTarget(this); | 1290 Stream<Event> get onSuccess => successEvent.forTarget(this); |
| 1230 | |
| 1231 } | 1291 } |
| 1232 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1292 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 1233 // for details. All rights reserved. Use of this source code is governed by a | 1293 // for details. All rights reserved. Use of this source code is governed by a |
| 1234 // BSD-style license that can be found in the LICENSE file. | 1294 // BSD-style license that can be found in the LICENSE file. |
| 1235 | 1295 |
| 1236 | |
| 1237 @DomName('IDBTransaction') | 1296 @DomName('IDBTransaction') |
| 1238 @Unstable() | 1297 @Unstable() |
| 1239 class Transaction extends EventTarget { | 1298 class Transaction extends EventTarget { |
| 1240 | |
| 1241 /** | 1299 /** |
| 1242 * Provides a Future which will be completed once the transaction has | 1300 * Provides a Future which will be completed once the transaction has |
| 1243 * completed. | 1301 * completed. |
| 1244 * | 1302 * |
| 1245 * The future will error if an error occurrs on the transaction or if the | 1303 * The future will error if an error occurrs on the transaction or if the |
| 1246 * transaction is aborted. | 1304 * transaction is aborted. |
| 1247 */ | 1305 */ |
| 1248 Future<Database> get completed { | 1306 Future<Database> get completed { |
| 1249 var completer = new Completer<Database>(); | 1307 var completer = new Completer<Database>(); |
| 1250 | 1308 |
| 1251 this.onComplete.first.then((_) { | 1309 this.onComplete.first.then((_) { |
| 1252 completer.complete(db); | 1310 completer.complete(db); |
| 1253 }); | 1311 }); |
| 1254 | 1312 |
| 1255 this.onError.first.then((e) { | 1313 this.onError.first.then((e) { |
| 1256 completer.completeError(e); | 1314 completer.completeError(e); |
| 1257 }); | 1315 }); |
| 1258 | 1316 |
| 1259 this.onAbort.first.then((e) { | 1317 this.onAbort.first.then((e) { |
| 1260 // Avoid completing twice if an error occurs. | 1318 // Avoid completing twice if an error occurs. |
| 1261 if (!completer.isCompleted) { | 1319 if (!completer.isCompleted) { |
| 1262 completer.completeError(e); | 1320 completer.completeError(e); |
| 1263 } | 1321 } |
| 1264 }); | 1322 }); |
| 1265 | 1323 |
| 1266 return completer.future; | 1324 return completer.future; |
| 1267 } | 1325 } |
| 1268 | 1326 |
| 1269 // To suppress missing implicit constructor warnings. | 1327 // To suppress missing implicit constructor warnings. |
| 1270 factory Transaction._() { throw new UnsupportedError("Not supported"); } | 1328 factory Transaction._() { |
| 1329 throw new UnsupportedError("Not supported"); |
| 1330 } |
| 1271 | 1331 |
| 1272 /** | 1332 /** |
| 1273 * Static factory designed to expose `abort` events to event | 1333 * Static factory designed to expose `abort` events to event |
| 1274 * handlers that are not necessarily instances of [Transaction]. | 1334 * handlers that are not necessarily instances of [Transaction]. |
| 1275 * | 1335 * |
| 1276 * See [EventStreamProvider] for usage information. | 1336 * See [EventStreamProvider] for usage information. |
| 1277 */ | 1337 */ |
| 1278 @DomName('IDBTransaction.abortEvent') | 1338 @DomName('IDBTransaction.abortEvent') |
| 1279 @DocsEditable() | 1339 @DocsEditable() |
| 1280 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 1340 static const EventStreamProvider<Event> abortEvent = |
| 1341 const EventStreamProvider<Event>('abort'); |
| 1281 | 1342 |
| 1282 /** | 1343 /** |
| 1283 * Static factory designed to expose `complete` events to event | 1344 * Static factory designed to expose `complete` events to event |
| 1284 * handlers that are not necessarily instances of [Transaction]. | 1345 * handlers that are not necessarily instances of [Transaction]. |
| 1285 * | 1346 * |
| 1286 * See [EventStreamProvider] for usage information. | 1347 * See [EventStreamProvider] for usage information. |
| 1287 */ | 1348 */ |
| 1288 @DomName('IDBTransaction.completeEvent') | 1349 @DomName('IDBTransaction.completeEvent') |
| 1289 @DocsEditable() | 1350 @DocsEditable() |
| 1290 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); | 1351 static const EventStreamProvider<Event> completeEvent = |
| 1352 const EventStreamProvider<Event>('complete'); |
| 1291 | 1353 |
| 1292 /** | 1354 /** |
| 1293 * Static factory designed to expose `error` events to event | 1355 * Static factory designed to expose `error` events to event |
| 1294 * handlers that are not necessarily instances of [Transaction]. | 1356 * handlers that are not necessarily instances of [Transaction]. |
| 1295 * | 1357 * |
| 1296 * See [EventStreamProvider] for usage information. | 1358 * See [EventStreamProvider] for usage information. |
| 1297 */ | 1359 */ |
| 1298 @DomName('IDBTransaction.errorEvent') | 1360 @DomName('IDBTransaction.errorEvent') |
| 1299 @DocsEditable() | 1361 @DocsEditable() |
| 1300 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1362 static const EventStreamProvider<Event> errorEvent = |
| 1301 | 1363 const EventStreamProvider<Event>('error'); |
| 1302 | 1364 |
| 1303 @Deprecated("Internal Use Only") | 1365 @Deprecated("Internal Use Only") |
| 1304 external static Type get instanceRuntimeType; | 1366 external static Type get instanceRuntimeType; |
| 1305 | 1367 |
| 1306 @Deprecated("Internal Use Only") | 1368 @Deprecated("Internal Use Only") |
| 1307 Transaction.internal_() : super.internal_(); | 1369 Transaction.internal_() : super.internal_(); |
| 1308 | 1370 |
| 1309 | |
| 1310 @DomName('IDBTransaction.db') | 1371 @DomName('IDBTransaction.db') |
| 1311 @DocsEditable() | 1372 @DocsEditable() |
| 1312 Database get db => _blink.BlinkIDBTransaction.instance.db_Getter_(this); | 1373 Database get db => _blink.BlinkIDBTransaction.instance.db_Getter_(this); |
| 1313 | 1374 |
| 1314 @DomName('IDBTransaction.error') | 1375 @DomName('IDBTransaction.error') |
| 1315 @DocsEditable() | 1376 @DocsEditable() |
| 1316 DomError get error => _blink.BlinkIDBTransaction.instance.error_Getter_(this); | 1377 DomError get error => _blink.BlinkIDBTransaction.instance.error_Getter_(this); |
| 1317 | 1378 |
| 1318 @DomName('IDBTransaction.mode') | 1379 @DomName('IDBTransaction.mode') |
| 1319 @DocsEditable() | 1380 @DocsEditable() |
| 1320 String get mode => _blink.BlinkIDBTransaction.instance.mode_Getter_(this); | 1381 String get mode => _blink.BlinkIDBTransaction.instance.mode_Getter_(this); |
| 1321 | 1382 |
| 1322 @DomName('IDBTransaction.objectStoreNames') | 1383 @DomName('IDBTransaction.objectStoreNames') |
| 1323 @DocsEditable() | 1384 @DocsEditable() |
| 1324 @Experimental() // untriaged | 1385 @Experimental() // untriaged |
| 1325 List<String> get objectStoreNames => _blink.BlinkIDBTransaction.instance.objec
tStoreNames_Getter_(this); | 1386 List<String> get objectStoreNames => |
| 1326 | 1387 _blink.BlinkIDBTransaction.instance.objectStoreNames_Getter_(this); |
| 1388 |
| 1327 @DomName('IDBTransaction.abort') | 1389 @DomName('IDBTransaction.abort') |
| 1328 @DocsEditable() | 1390 @DocsEditable() |
| 1329 void abort() => _blink.BlinkIDBTransaction.instance.abort_Callback_0_(this); | 1391 void abort() => _blink.BlinkIDBTransaction.instance.abort_Callback_0_(this); |
| 1330 | 1392 |
| 1331 @DomName('IDBTransaction.objectStore') | 1393 @DomName('IDBTransaction.objectStore') |
| 1332 @DocsEditable() | 1394 @DocsEditable() |
| 1333 ObjectStore objectStore(String name) => _blink.BlinkIDBTransaction.instance.ob
jectStore_Callback_1_(this, name); | 1395 ObjectStore objectStore(String name) => |
| 1334 | 1396 _blink.BlinkIDBTransaction.instance.objectStore_Callback_1_(this, name); |
| 1397 |
| 1335 /// Stream of `abort` events handled by this [Transaction]. | 1398 /// Stream of `abort` events handled by this [Transaction]. |
| 1336 @DomName('IDBTransaction.onabort') | 1399 @DomName('IDBTransaction.onabort') |
| 1337 @DocsEditable() | 1400 @DocsEditable() |
| 1338 Stream<Event> get onAbort => abortEvent.forTarget(this); | 1401 Stream<Event> get onAbort => abortEvent.forTarget(this); |
| 1339 | 1402 |
| 1340 /// Stream of `complete` events handled by this [Transaction]. | 1403 /// Stream of `complete` events handled by this [Transaction]. |
| 1341 @DomName('IDBTransaction.oncomplete') | 1404 @DomName('IDBTransaction.oncomplete') |
| 1342 @DocsEditable() | 1405 @DocsEditable() |
| 1343 Stream<Event> get onComplete => completeEvent.forTarget(this); | 1406 Stream<Event> get onComplete => completeEvent.forTarget(this); |
| 1344 | 1407 |
| 1345 /// Stream of `error` events handled by this [Transaction]. | 1408 /// Stream of `error` events handled by this [Transaction]. |
| 1346 @DomName('IDBTransaction.onerror') | 1409 @DomName('IDBTransaction.onerror') |
| 1347 @DocsEditable() | 1410 @DocsEditable() |
| 1348 Stream<Event> get onError => errorEvent.forTarget(this); | 1411 Stream<Event> get onError => errorEvent.forTarget(this); |
| 1349 | |
| 1350 } | 1412 } |
| 1351 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1413 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1352 // for details. All rights reserved. Use of this source code is governed by a | 1414 // for details. All rights reserved. Use of this source code is governed by a |
| 1353 // BSD-style license that can be found in the LICENSE file. | 1415 // BSD-style license that can be found in the LICENSE file. |
| 1354 | 1416 |
| 1355 // WARNING: Do not edit - generated code. | 1417 // WARNING: Do not edit - generated code. |
| 1356 | 1418 |
| 1357 | |
| 1358 @DocsEditable() | 1419 @DocsEditable() |
| 1359 @DomName('IDBVersionChangeEvent') | 1420 @DomName('IDBVersionChangeEvent') |
| 1360 @Unstable() | 1421 @Unstable() |
| 1361 class VersionChangeEvent extends Event { | 1422 class VersionChangeEvent extends Event { |
| 1362 // To suppress missing implicit constructor warnings. | 1423 // To suppress missing implicit constructor warnings. |
| 1363 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported");
} | 1424 factory VersionChangeEvent._() { |
| 1425 throw new UnsupportedError("Not supported"); |
| 1426 } |
| 1364 | 1427 |
| 1365 @DomName('IDBVersionChangeEvent.IDBVersionChangeEvent') | 1428 @DomName('IDBVersionChangeEvent.IDBVersionChangeEvent') |
| 1366 @DocsEditable() | 1429 @DocsEditable() |
| 1367 factory VersionChangeEvent(String type, [Map eventInitDict]) { | 1430 factory VersionChangeEvent(String type, [Map eventInitDict]) { |
| 1368 if (eventInitDict != null) { | 1431 if (eventInitDict != null) { |
| 1369 var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict); | 1432 var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict); |
| 1370 return _blink.BlinkIDBVersionChangeEvent.instance.constructorCallback_2_(t
ype, eventInitDict_1); | 1433 return _blink.BlinkIDBVersionChangeEvent.instance |
| 1434 .constructorCallback_2_(type, eventInitDict_1); |
| 1371 } | 1435 } |
| 1372 return _blink.BlinkIDBVersionChangeEvent.instance.constructorCallback_1_(typ
e); | 1436 return _blink.BlinkIDBVersionChangeEvent.instance |
| 1437 .constructorCallback_1_(type); |
| 1373 } | 1438 } |
| 1374 | 1439 |
| 1375 | |
| 1376 @Deprecated("Internal Use Only") | 1440 @Deprecated("Internal Use Only") |
| 1377 external static Type get instanceRuntimeType; | 1441 external static Type get instanceRuntimeType; |
| 1378 | 1442 |
| 1379 @Deprecated("Internal Use Only") | 1443 @Deprecated("Internal Use Only") |
| 1380 VersionChangeEvent.internal_() : super.internal_(); | 1444 VersionChangeEvent.internal_() : super.internal_(); |
| 1381 | 1445 |
| 1382 | |
| 1383 @DomName('IDBVersionChangeEvent.dataLoss') | 1446 @DomName('IDBVersionChangeEvent.dataLoss') |
| 1384 @DocsEditable() | 1447 @DocsEditable() |
| 1385 @Experimental() // untriaged | 1448 @Experimental() // untriaged |
| 1386 String get dataLoss => _blink.BlinkIDBVersionChangeEvent.instance.dataLoss_Get
ter_(this); | 1449 String get dataLoss => |
| 1387 | 1450 _blink.BlinkIDBVersionChangeEvent.instance.dataLoss_Getter_(this); |
| 1451 |
| 1388 @DomName('IDBVersionChangeEvent.dataLossMessage') | 1452 @DomName('IDBVersionChangeEvent.dataLossMessage') |
| 1389 @DocsEditable() | 1453 @DocsEditable() |
| 1390 @Experimental() // untriaged | 1454 @Experimental() // untriaged |
| 1391 String get dataLossMessage => _blink.BlinkIDBVersionChangeEvent.instance.dataL
ossMessage_Getter_(this); | 1455 String get dataLossMessage => |
| 1392 | 1456 _blink.BlinkIDBVersionChangeEvent.instance.dataLossMessage_Getter_(this); |
| 1457 |
| 1393 @DomName('IDBVersionChangeEvent.newVersion') | 1458 @DomName('IDBVersionChangeEvent.newVersion') |
| 1394 @DocsEditable() | 1459 @DocsEditable() |
| 1395 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge
tter_(this); | 1460 int get newVersion => |
| 1396 | 1461 _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Getter_(this); |
| 1462 |
| 1397 @DomName('IDBVersionChangeEvent.oldVersion') | 1463 @DomName('IDBVersionChangeEvent.oldVersion') |
| 1398 @DocsEditable() | 1464 @DocsEditable() |
| 1399 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge
tter_(this); | 1465 int get oldVersion => |
| 1400 | 1466 _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Getter_(this); |
| 1401 } | 1467 } |
| OLD | NEW |