OLD | NEW |
1 library dart.dom.indexed_db; | 1 library dart.dom.indexed_db; |
2 | 2 |
3 import 'dart:async'; | 3 import 'dart:async'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; | 7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; |
8 import 'dart:_foreign_helper' show JS; | 8 import 'dart:_foreign_helper' show JS; |
9 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 9 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
10 // for details. All rights reserved. Use of this source code is governed by a | 10 // for details. All rights reserved. Use of this source code is governed by a |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 if (keyPath != null) { | 242 if (keyPath != null) { |
243 options['keyPath'] = keyPath; | 243 options['keyPath'] = keyPath; |
244 } | 244 } |
245 if (autoIncrement != null) { | 245 if (autoIncrement != null) { |
246 options['autoIncrement'] = autoIncrement; | 246 options['autoIncrement'] = autoIncrement; |
247 } | 247 } |
248 | 248 |
249 return $dom_createObjectStore(name, options); | 249 return $dom_createObjectStore(name, options); |
250 } | 250 } |
251 | 251 |
252 Transaction transaction(storeName_OR_storeNames, String mode) { | 252 Transaction transaction(String storeName, String mode) { |
253 if (mode != 'readonly' && mode != 'readwrite') { | 253 if (mode != 'readonly' && mode != 'readwrite') { |
254 throw new ArgumentError(mode); | 254 throw new ArgumentError(mode); |
255 } | 255 } |
256 | |
257 // TODO(sra): Ensure storeName_OR_storeNames is a string or List<String>, | |
258 // and copy to JavaScript array if necessary. | |
259 | |
260 // Try and create a transaction with a string mode. Browsers that expect a | 256 // Try and create a transaction with a string mode. Browsers that expect a |
261 // numeric mode tend to convert the string into a number. This fails | 257 // numeric mode tend to convert the string into a number. This fails |
262 // silently, resulting in zero ('readonly'). | 258 // silently, resulting in zero ('readonly'). |
263 return _transaction(storeName_OR_storeNames, mode); | 259 return _transaction(storeName, mode); |
| 260 } |
| 261 |
| 262 Transaction transactionList(List<String> storeNames, String mode) { |
| 263 if (mode != 'readonly' && mode != 'readwrite') { |
| 264 throw new ArgumentError(mode); |
| 265 } |
| 266 List storeNames_1 = convertDartToNative_StringArray(storeNames); |
| 267 return _transaction(storeNames_1, mode); |
| 268 } |
| 269 |
| 270 Transaction transactionStringList(DomStringList storeNames, String mode) { |
| 271 if (mode != 'readonly' && mode != 'readwrite') { |
| 272 throw new ArgumentError(mode); |
| 273 } |
| 274 return _transaction(storeNames_1, mode); |
264 } | 275 } |
265 | 276 |
266 @JSName('transaction') | 277 @JSName('transaction') |
267 Transaction _transaction(stores, mode) native; | 278 Transaction _transaction(stores, mode) native; |
268 | 279 |
269 | 280 |
270 @DomName('IDBDatabase.abortEvent') | 281 @DomName('IDBDatabase.abortEvent') |
271 @DocsEditable | 282 @DocsEditable |
272 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 283 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); |
273 | 284 |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1269 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
1259 // for details. All rights reserved. Use of this source code is governed by a | 1270 // for details. All rights reserved. Use of this source code is governed by a |
1260 // BSD-style license that can be found in the LICENSE file. | 1271 // BSD-style license that can be found in the LICENSE file. |
1261 | 1272 |
1262 | 1273 |
1263 @DocsEditable | 1274 @DocsEditable |
1264 @DomName('IDBAny') | 1275 @DomName('IDBAny') |
1265 @deprecated // nonstandard | 1276 @deprecated // nonstandard |
1266 abstract class _IDBAny native "IDBAny" { | 1277 abstract class _IDBAny native "IDBAny" { |
1267 } | 1278 } |
OLD | NEW |