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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static KeyRange createKeyRange_upperBound( | 101 static KeyRange createKeyRange_upperBound( |
102 /*IDBKey*/ bound, [bool open = false]) => | 102 /*IDBKey*/ bound, [bool open = false]) => |
103 KeyRange.upperBound_(bound, open); | 103 KeyRange.upperBound_(bound, open); |
104 | 104 |
105 static KeyRange createKeyRange_bound( | 105 static KeyRange createKeyRange_bound( |
106 /*IDBKey*/ lower, /*IDBKey*/ upper, | 106 /*IDBKey*/ lower, /*IDBKey*/ upper, |
107 [bool lowerOpen = false, bool upperOpen = false]) => | 107 [bool lowerOpen = false, bool upperOpen = false]) => |
108 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); | 108 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); |
109 } | 109 } |
110 // FIXME: Can we make this private? | 110 // FIXME: Can we make this private? |
| 111 @Deprecated("Internal Use Only") |
111 final indexed_dbBlinkMap = { | 112 final indexed_dbBlinkMap = { |
112 'IDBCursor': () => Cursor, | 113 'IDBCursor': () => Cursor, |
113 'IDBCursorWithValue': () => CursorWithValue, | 114 'IDBCursorWithValue': () => CursorWithValue, |
114 'IDBDatabase': () => Database, | 115 'IDBDatabase': () => Database, |
115 'IDBFactory': () => IdbFactory, | 116 'IDBFactory': () => IdbFactory, |
116 'IDBIndex': () => Index, | 117 'IDBIndex': () => Index, |
117 'IDBKeyRange': () => KeyRange, | 118 'IDBKeyRange': () => KeyRange, |
118 'IDBObjectStore': () => ObjectStore, | 119 'IDBObjectStore': () => ObjectStore, |
119 'IDBOpenDBRequest': () => OpenDBRequest, | 120 'IDBOpenDBRequest': () => OpenDBRequest, |
120 'IDBRequest': () => Request, | 121 'IDBRequest': () => Request, |
121 'IDBTransaction': () => Transaction, | 122 'IDBTransaction': () => Transaction, |
122 'IDBVersionChangeEvent': () => VersionChangeEvent, | 123 'IDBVersionChangeEvent': () => VersionChangeEvent, |
123 | 124 |
124 }; | 125 }; |
125 | 126 |
126 // FIXME: Can we make this private? | 127 // FIXME: Can we make this private? |
| 128 @Deprecated("Internal Use Only") |
127 final indexed_dbBlinkFunctionMap = { | 129 final indexed_dbBlinkFunctionMap = { |
128 'IDBCursor': () => Cursor.internalCreateCursor, | 130 'IDBCursor': () => Cursor.internalCreateCursor, |
129 'IDBCursorWithValue': () => CursorWithValue.internalCreateCursorWithValue, | 131 'IDBCursorWithValue': () => CursorWithValue.internalCreateCursorWithValue, |
130 'IDBDatabase': () => Database.internalCreateDatabase, | 132 'IDBDatabase': () => Database.internalCreateDatabase, |
131 'IDBFactory': () => IdbFactory.internalCreateIdbFactory, | 133 'IDBFactory': () => IdbFactory.internalCreateIdbFactory, |
132 'IDBIndex': () => Index.internalCreateIndex, | 134 'IDBIndex': () => Index.internalCreateIndex, |
133 'IDBKeyRange': () => KeyRange.internalCreateKeyRange, | 135 'IDBKeyRange': () => KeyRange.internalCreateKeyRange, |
134 'IDBObjectStore': () => ObjectStore.internalCreateObjectStore, | 136 'IDBObjectStore': () => ObjectStore.internalCreateObjectStore, |
135 'IDBOpenDBRequest': () => OpenDBRequest.internalCreateOpenDBRequest, | 137 'IDBOpenDBRequest': () => OpenDBRequest.internalCreateOpenDBRequest, |
136 'IDBRequest': () => Request.internalCreateRequest, | 138 'IDBRequest': () => Request.internalCreateRequest, |
(...skipping 23 matching lines...) Expand all Loading... |
160 try { | 162 try { |
161 return _completeRequest(_update(value)); | 163 return _completeRequest(_update(value)); |
162 } catch (e, stacktrace) { | 164 } catch (e, stacktrace) { |
163 return new Future.error(e, stacktrace); | 165 return new Future.error(e, stacktrace); |
164 } | 166 } |
165 } | 167 } |
166 | 168 |
167 // To suppress missing implicit constructor warnings. | 169 // To suppress missing implicit constructor warnings. |
168 factory Cursor._() { throw new UnsupportedError("Not supported"); } | 170 factory Cursor._() { throw new UnsupportedError("Not supported"); } |
169 | 171 |
| 172 @Deprecated("Internal Use Only") |
170 static Cursor internalCreateCursor() { | 173 static Cursor internalCreateCursor() { |
171 return new Cursor._internalWrap(); | 174 return new Cursor._internalWrap(); |
172 } | 175 } |
173 | 176 |
174 factory Cursor._internalWrap() { | 177 factory Cursor._internalWrap() { |
175 return new Cursor.internal_(); | 178 return new Cursor.internal_(); |
176 } | 179 } |
177 | 180 |
178 Cursor.internal_() { } | 181 Cursor.internal_() { } |
179 | 182 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 234 |
232 | 235 |
233 @DocsEditable() | 236 @DocsEditable() |
234 @DomName('IDBCursorWithValue') | 237 @DomName('IDBCursorWithValue') |
235 @Unstable() | 238 @Unstable() |
236 class CursorWithValue extends Cursor { | 239 class CursorWithValue extends Cursor { |
237 // To suppress missing implicit constructor warnings. | 240 // To suppress missing implicit constructor warnings. |
238 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); } | 241 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); } |
239 | 242 |
240 | 243 |
| 244 @Deprecated("Internal Use Only") |
241 static CursorWithValue internalCreateCursorWithValue() { | 245 static CursorWithValue internalCreateCursorWithValue() { |
242 return new CursorWithValue._internalWrap(); | 246 return new CursorWithValue._internalWrap(); |
243 } | 247 } |
244 | 248 |
245 factory CursorWithValue._internalWrap() { | 249 factory CursorWithValue._internalWrap() { |
246 return new CursorWithValue.internal_(); | 250 return new CursorWithValue.internal_(); |
247 } | 251 } |
248 | 252 |
249 CursorWithValue.internal_() : super.internal_(); | 253 CursorWithValue.internal_() : super.internal_(); |
250 | 254 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 * Static factory designed to expose `versionchange` events to event | 330 * Static factory designed to expose `versionchange` events to event |
327 * handlers that are not necessarily instances of [Database]. | 331 * handlers that are not necessarily instances of [Database]. |
328 * | 332 * |
329 * See [EventStreamProvider] for usage information. | 333 * See [EventStreamProvider] for usage information. |
330 */ | 334 */ |
331 @DomName('IDBDatabase.versionchangeEvent') | 335 @DomName('IDBDatabase.versionchangeEvent') |
332 @DocsEditable() | 336 @DocsEditable() |
333 static const EventStreamProvider<VersionChangeEvent> versionChangeEvent = cons
t EventStreamProvider<VersionChangeEvent>('versionchange'); | 337 static const EventStreamProvider<VersionChangeEvent> versionChangeEvent = cons
t EventStreamProvider<VersionChangeEvent>('versionchange'); |
334 | 338 |
335 | 339 |
| 340 @Deprecated("Internal Use Only") |
336 static Database internalCreateDatabase() { | 341 static Database internalCreateDatabase() { |
337 return new Database._internalWrap(); | 342 return new Database._internalWrap(); |
338 } | 343 } |
339 | 344 |
340 factory Database._internalWrap() { | 345 factory Database._internalWrap() { |
341 return new Database.internal_(); | 346 return new Database.internal_(); |
342 } | 347 } |
343 | 348 |
344 Database.internal_() : super.internal_(); | 349 Database.internal_() : super.internal_(); |
345 | 350 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 /** | 524 /** |
520 * Checks to see if getDatabaseNames is supported by the current platform. | 525 * Checks to see if getDatabaseNames is supported by the current platform. |
521 */ | 526 */ |
522 bool get supportsDatabaseNames { | 527 bool get supportsDatabaseNames { |
523 return true; | 528 return true; |
524 } | 529 } |
525 | 530 |
526 // To suppress missing implicit constructor warnings. | 531 // To suppress missing implicit constructor warnings. |
527 factory IdbFactory._() { throw new UnsupportedError("Not supported"); } | 532 factory IdbFactory._() { throw new UnsupportedError("Not supported"); } |
528 | 533 |
| 534 @Deprecated("Internal Use Only") |
529 static IdbFactory internalCreateIdbFactory() { | 535 static IdbFactory internalCreateIdbFactory() { |
530 return new IdbFactory._internalWrap(); | 536 return new IdbFactory._internalWrap(); |
531 } | 537 } |
532 | 538 |
533 factory IdbFactory._internalWrap() { | 539 factory IdbFactory._internalWrap() { |
534 return new IdbFactory.internal_(); | 540 return new IdbFactory.internal_(); |
535 } | 541 } |
536 | 542 |
537 IdbFactory.internal_() { } | 543 IdbFactory.internal_() { } |
538 | 544 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 request = _openKeyCursor(key_OR_range, "next"); | 676 request = _openKeyCursor(key_OR_range, "next"); |
671 } else { | 677 } else { |
672 request = _openKeyCursor(key_OR_range, direction); | 678 request = _openKeyCursor(key_OR_range, direction); |
673 } | 679 } |
674 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 680 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
675 } | 681 } |
676 | 682 |
677 // To suppress missing implicit constructor warnings. | 683 // To suppress missing implicit constructor warnings. |
678 factory Index._() { throw new UnsupportedError("Not supported"); } | 684 factory Index._() { throw new UnsupportedError("Not supported"); } |
679 | 685 |
| 686 @Deprecated("Internal Use Only") |
680 static Index internalCreateIndex() { | 687 static Index internalCreateIndex() { |
681 return new Index._internalWrap(); | 688 return new Index._internalWrap(); |
682 } | 689 } |
683 | 690 |
684 factory Index._internalWrap() { | 691 factory Index._internalWrap() { |
685 return new Index.internal_(); | 692 return new Index.internal_(); |
686 } | 693 } |
687 | 694 |
688 Index.internal_() { } | 695 Index.internal_() { } |
689 | 696 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 766 |
760 @DomName('KeyRange.bound') | 767 @DomName('KeyRange.bound') |
761 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, | 768 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, |
762 [bool lowerOpen = false, bool upperOpen = false]) => | 769 [bool lowerOpen = false, bool upperOpen = false]) => |
763 _KeyRangeFactoryProvider.createKeyRange_bound( | 770 _KeyRangeFactoryProvider.createKeyRange_bound( |
764 lower, upper, lowerOpen, upperOpen); | 771 lower, upper, lowerOpen, upperOpen); |
765 | 772 |
766 // To suppress missing implicit constructor warnings. | 773 // To suppress missing implicit constructor warnings. |
767 factory KeyRange._() { throw new UnsupportedError("Not supported"); } | 774 factory KeyRange._() { throw new UnsupportedError("Not supported"); } |
768 | 775 |
| 776 @Deprecated("Internal Use Only") |
769 static KeyRange internalCreateKeyRange() { | 777 static KeyRange internalCreateKeyRange() { |
770 return new KeyRange._internalWrap(); | 778 return new KeyRange._internalWrap(); |
771 } | 779 } |
772 | 780 |
773 factory KeyRange._internalWrap() { | 781 factory KeyRange._internalWrap() { |
774 return new KeyRange.internal_(); | 782 return new KeyRange.internal_(); |
775 } | 783 } |
776 | 784 |
777 KeyRange.internal_() { } | 785 KeyRange.internal_() { } |
778 | 786 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 if (multiEntry != null) { | 964 if (multiEntry != null) { |
957 options['multiEntry'] = multiEntry; | 965 options['multiEntry'] = multiEntry; |
958 } | 966 } |
959 | 967 |
960 return _createIndex(name, keyPath, options); | 968 return _createIndex(name, keyPath, options); |
961 } | 969 } |
962 | 970 |
963 // To suppress missing implicit constructor warnings. | 971 // To suppress missing implicit constructor warnings. |
964 factory ObjectStore._() { throw new UnsupportedError("Not supported"); } | 972 factory ObjectStore._() { throw new UnsupportedError("Not supported"); } |
965 | 973 |
| 974 @Deprecated("Internal Use Only") |
966 static ObjectStore internalCreateObjectStore() { | 975 static ObjectStore internalCreateObjectStore() { |
967 return new ObjectStore._internalWrap(); | 976 return new ObjectStore._internalWrap(); |
968 } | 977 } |
969 | 978 |
970 factory ObjectStore._internalWrap() { | 979 factory ObjectStore._internalWrap() { |
971 return new ObjectStore.internal_(); | 980 return new ObjectStore.internal_(); |
972 } | 981 } |
973 | 982 |
974 ObjectStore.internal_() { } | 983 ObjectStore.internal_() { } |
975 | 984 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 * Static factory designed to expose `upgradeneeded` events to event | 1129 * Static factory designed to expose `upgradeneeded` events to event |
1121 * handlers that are not necessarily instances of [OpenDBRequest]. | 1130 * handlers that are not necessarily instances of [OpenDBRequest]. |
1122 * | 1131 * |
1123 * See [EventStreamProvider] for usage information. | 1132 * See [EventStreamProvider] for usage information. |
1124 */ | 1133 */ |
1125 @DomName('IDBOpenDBRequest.upgradeneededEvent') | 1134 @DomName('IDBOpenDBRequest.upgradeneededEvent') |
1126 @DocsEditable() | 1135 @DocsEditable() |
1127 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); | 1136 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); |
1128 | 1137 |
1129 | 1138 |
| 1139 @Deprecated("Internal Use Only") |
1130 static OpenDBRequest internalCreateOpenDBRequest() { | 1140 static OpenDBRequest internalCreateOpenDBRequest() { |
1131 return new OpenDBRequest._internalWrap(); | 1141 return new OpenDBRequest._internalWrap(); |
1132 } | 1142 } |
1133 | 1143 |
1134 factory OpenDBRequest._internalWrap() { | 1144 factory OpenDBRequest._internalWrap() { |
1135 return new OpenDBRequest.internal_(); | 1145 return new OpenDBRequest.internal_(); |
1136 } | 1146 } |
1137 | 1147 |
1138 OpenDBRequest.internal_() : super.internal_(); | 1148 OpenDBRequest.internal_() : super.internal_(); |
1139 | 1149 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 * Static factory designed to expose `success` events to event | 1187 * Static factory designed to expose `success` events to event |
1178 * handlers that are not necessarily instances of [Request]. | 1188 * handlers that are not necessarily instances of [Request]. |
1179 * | 1189 * |
1180 * See [EventStreamProvider] for usage information. | 1190 * See [EventStreamProvider] for usage information. |
1181 */ | 1191 */ |
1182 @DomName('IDBRequest.successEvent') | 1192 @DomName('IDBRequest.successEvent') |
1183 @DocsEditable() | 1193 @DocsEditable() |
1184 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); | 1194 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); |
1185 | 1195 |
1186 | 1196 |
| 1197 @Deprecated("Internal Use Only") |
1187 static Request internalCreateRequest() { | 1198 static Request internalCreateRequest() { |
1188 return new Request._internalWrap(); | 1199 return new Request._internalWrap(); |
1189 } | 1200 } |
1190 | 1201 |
1191 factory Request._internalWrap() { | 1202 factory Request._internalWrap() { |
1192 return new Request.internal_(); | 1203 return new Request.internal_(); |
1193 } | 1204 } |
1194 | 1205 |
1195 Request.internal_() : super.internal_(); | 1206 Request.internal_() : super.internal_(); |
1196 | 1207 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 * Static factory designed to expose `error` events to event | 1301 * Static factory designed to expose `error` events to event |
1291 * handlers that are not necessarily instances of [Transaction]. | 1302 * handlers that are not necessarily instances of [Transaction]. |
1292 * | 1303 * |
1293 * See [EventStreamProvider] for usage information. | 1304 * See [EventStreamProvider] for usage information. |
1294 */ | 1305 */ |
1295 @DomName('IDBTransaction.errorEvent') | 1306 @DomName('IDBTransaction.errorEvent') |
1296 @DocsEditable() | 1307 @DocsEditable() |
1297 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1308 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
1298 | 1309 |
1299 | 1310 |
| 1311 @Deprecated("Internal Use Only") |
1300 static Transaction internalCreateTransaction() { | 1312 static Transaction internalCreateTransaction() { |
1301 return new Transaction._internalWrap(); | 1313 return new Transaction._internalWrap(); |
1302 } | 1314 } |
1303 | 1315 |
1304 factory Transaction._internalWrap() { | 1316 factory Transaction._internalWrap() { |
1305 return new Transaction.internal_(); | 1317 return new Transaction.internal_(); |
1306 } | 1318 } |
1307 | 1319 |
1308 Transaction.internal_() : super.internal_(); | 1320 Transaction.internal_() : super.internal_(); |
1309 | 1321 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 | 1364 |
1353 | 1365 |
1354 @DocsEditable() | 1366 @DocsEditable() |
1355 @DomName('IDBVersionChangeEvent') | 1367 @DomName('IDBVersionChangeEvent') |
1356 @Unstable() | 1368 @Unstable() |
1357 class VersionChangeEvent extends Event { | 1369 class VersionChangeEvent extends Event { |
1358 // To suppress missing implicit constructor warnings. | 1370 // To suppress missing implicit constructor warnings. |
1359 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported");
} | 1371 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported");
} |
1360 | 1372 |
1361 | 1373 |
| 1374 @Deprecated("Internal Use Only") |
1362 static VersionChangeEvent internalCreateVersionChangeEvent() { | 1375 static VersionChangeEvent internalCreateVersionChangeEvent() { |
1363 return new VersionChangeEvent._internalWrap(); | 1376 return new VersionChangeEvent._internalWrap(); |
1364 } | 1377 } |
1365 | 1378 |
1366 factory VersionChangeEvent._internalWrap() { | 1379 factory VersionChangeEvent._internalWrap() { |
1367 return new VersionChangeEvent.internal_(); | 1380 return new VersionChangeEvent.internal_(); |
1368 } | 1381 } |
1369 | 1382 |
1370 VersionChangeEvent.internal_() : super.internal_(); | 1383 VersionChangeEvent.internal_() : super.internal_(); |
1371 | 1384 |
(...skipping 10 matching lines...) Expand all Loading... |
1382 | 1395 |
1383 @DomName('IDBVersionChangeEvent.newVersion') | 1396 @DomName('IDBVersionChangeEvent.newVersion') |
1384 @DocsEditable() | 1397 @DocsEditable() |
1385 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge
tter_(unwrap_jso(this)); | 1398 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge
tter_(unwrap_jso(this)); |
1386 | 1399 |
1387 @DomName('IDBVersionChangeEvent.oldVersion') | 1400 @DomName('IDBVersionChangeEvent.oldVersion') |
1388 @DocsEditable() | 1401 @DocsEditable() |
1389 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge
tter_(unwrap_jso(this)); | 1402 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge
tter_(unwrap_jso(this)); |
1390 | 1403 |
1391 } | 1404 } |
OLD | NEW |