OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 @DocsEditable() | 7 @DocsEditable() |
8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
9 @DomName('IDBDatabase.createObjectStore') | 9 @DomName('IDBDatabase.createObjectStore') |
10 @DocsEditable() | 10 @DocsEditable() |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return _transaction(storeName, mode); | 46 return _transaction(storeName, mode); |
47 } | 47 } |
48 | 48 |
49 Transaction transactionList(List<String> storeNames, String mode) { | 49 Transaction transactionList(List<String> storeNames, String mode) { |
50 if (mode != 'readonly' && mode != 'readwrite') { | 50 if (mode != 'readonly' && mode != 'readwrite') { |
51 throw new ArgumentError(mode); | 51 throw new ArgumentError(mode); |
52 } | 52 } |
53 List storeNames_1 = convertDartToNative_StringArray(storeNames); | 53 List storeNames_1 = convertDartToNative_StringArray(storeNames); |
54 return _transaction(storeNames_1, mode); | 54 return _transaction(storeNames_1, mode); |
55 } | 55 } |
56 | 56 |
57 Transaction transactionStores(DomStringList storeNames, String mode) { | 57 Transaction transactionStores(DomStringList storeNames, String mode) { |
58 if (mode != 'readonly' && mode != 'readwrite') { | 58 if (mode != 'readonly' && mode != 'readwrite') { |
59 throw new ArgumentError(mode); | 59 throw new ArgumentError(mode); |
60 } | 60 } |
61 return _transaction(storeNames, mode); | 61 return _transaction(storeNames, mode); |
62 } | 62 } |
63 | 63 |
64 @JSName('transaction') | 64 @JSName('transaction') |
65 Transaction _transaction(stores, mode) native; | 65 Transaction _transaction(stores, mode) native; |
| 66 $else |
| 67 Transaction transaction(storeName_OR_storeNames, String mode) { |
| 68 if (mode != 'readonly' && mode != 'readwrite') { |
| 69 throw new ArgumentError("Invalid transaction mode $mode"); |
| 70 } |
| 71 var names; |
| 72 if (storeName_OR_storeNames == null) { |
| 73 throw new ArgumentError("stores may not be null in transaction"); |
| 74 } else if (storeName_OR_storeNames is String || storeName_OR_storeNames is D
omStringList) { |
| 75 names = unwrap_jso(storeName_OR_storeNames); |
| 76 } else if (storeName_OR_storeNames is List<String>) { |
| 77 names = convertDartToNative_List(storeName_OR_storeNames); |
| 78 } else { |
| 79 throw new ArgumentError("Invalid store(s) $store_Name_OR_storeNames"); |
| 80 } |
| 81 |
| 82 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(unw
rap_jso(this), names, mode)); |
| 83 } |
| 84 |
| 85 Transaction transactionList(List<String> storeNames, String mode) => transacti
on(storeNames, mode); |
| 86 Transaction transactionStores(List<String> storeNames, String mode) => transac
tion(storeNames, mode); |
| 87 Transaction transactionStore(String storeName, String mode) => transaction(sto
reName, mode); |
66 $endif | 88 $endif |
67 | 89 |
68 $!MEMBERS} | 90 $!MEMBERS} |
OLD | NEW |