OLD | NEW |
1 library indexed_db; | 1 library 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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 6 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
7 // for details. All rights reserved. Use of this source code is governed by a | 7 // for details. All rights reserved. Use of this source code is governed by a |
8 // BSD-style license that can be found in the LICENSE file. | 8 // BSD-style license that can be found in the LICENSE file. |
9 | 9 |
10 // DO NOT EDIT | 10 // DO NOT EDIT |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 containsDate(object) { | 91 containsDate(object) { |
92 if (isJavaScriptDate(object)) return true; | 92 if (isJavaScriptDate(object)) return true; |
93 if (object is List) { | 93 if (object is List) { |
94 for (int i = 0; i < object.length; i++) { | 94 for (int i = 0; i < object.length; i++) { |
95 if (containsDate(object[i])) return true; | 95 if (containsDate(object[i])) return true; |
96 } | 96 } |
97 } | 97 } |
98 return false; // number, string. | 98 return false; // number, string. |
99 } | 99 } |
100 if (containsDate(nativeKey)) { | 100 if (containsDate(nativeKey)) { |
101 throw new UnimplementedError('Key containing Date'); | 101 throw new UnimplementedError('Key containing DateTime'); |
102 } | 102 } |
103 // TODO: Cache conversion somewhere? | 103 // TODO: Cache conversion somewhere? |
104 return nativeKey; | 104 return nativeKey; |
105 } | 105 } |
106 | 106 |
107 /** | 107 /** |
108 * Converts a Dart object into a valid IDBKey. | 108 * Converts a Dart object into a valid IDBKey. |
109 * | 109 * |
110 * May return the original input. Does not mutate input. | 110 * May return the original input. Does not mutate input. |
111 * | 111 * |
112 * If necessary, [dartKey] may be copied to ensure all lists are converted into | 112 * If necessary, [dartKey] may be copied to ensure all lists are converted into |
113 * JavaScript Arrays and Dart Dates into JavaScript Dates. | 113 * JavaScript Arrays and Dart Dates into JavaScript Dates. |
114 */ | 114 */ |
115 _convertDartToNative_IDBKey(dartKey) { | 115 _convertDartToNative_IDBKey(dartKey) { |
116 // TODO: Implement. | 116 // TODO: Implement. |
117 return dartKey; | 117 return dartKey; |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 | 121 |
122 /// May modify original. If so, action is idempotent. | 122 /// May modify original. If so, action is idempotent. |
123 _convertNativeToDart_IDBAny(object) { | 123 _convertNativeToDart_IDBAny(object) { |
124 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false); | 124 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false); |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add Date. | 128 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add DateTime. |
129 const _annotation_Creates_IDBKey = const Creates(_idbKey); | 129 const _annotation_Creates_IDBKey = const Creates(_idbKey); |
130 const _annotation_Returns_IDBKey = const Returns(_idbKey); | 130 const _annotation_Returns_IDBKey = const Returns(_idbKey); |
131 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 131 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
132 // for details. All rights reserved. Use of this source code is governed by a | 132 // for details. All rights reserved. Use of this source code is governed by a |
133 // BSD-style license that can be found in the LICENSE file. | 133 // BSD-style license that can be found in the LICENSE file. |
134 | 134 |
135 | 135 |
136 | 136 |
137 @DocsEditable | 137 @DocsEditable |
138 @DomName('IDBCursor') | 138 @DomName('IDBCursor') |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1285 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
1286 // for details. All rights reserved. Use of this source code is governed by a | 1286 // for details. All rights reserved. Use of this source code is governed by a |
1287 // BSD-style license that can be found in the LICENSE file. | 1287 // BSD-style license that can be found in the LICENSE file. |
1288 | 1288 |
1289 | 1289 |
1290 | 1290 |
1291 @DocsEditable | 1291 @DocsEditable |
1292 @DomName('IDBAny') | 1292 @DomName('IDBAny') |
1293 class _Any native "*IDBAny" { | 1293 class _Any native "*IDBAny" { |
1294 } | 1294 } |
OLD | NEW |