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