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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 } | 378 } |
379 return _transaction(storeNames, mode); | 379 return _transaction(storeNames, mode); |
380 } | 380 } |
381 | 381 |
382 @JSName('transaction') | 382 @JSName('transaction') |
383 Transaction _transaction(stores, mode) native; | 383 Transaction _transaction(stores, mode) native; |
384 | 384 |
385 // To suppress missing implicit constructor warnings. | 385 // To suppress missing implicit constructor warnings. |
386 factory Database._() { throw new UnsupportedError("Not supported"); } | 386 factory Database._() { throw new UnsupportedError("Not supported"); } |
387 | 387 |
| 388 /** |
| 389 * Static factory designed to expose `abort` events to event |
| 390 * handlers that are not necessarily instances of [Database]. |
| 391 * |
| 392 * See [EventStreamProvider] for usage information. |
| 393 */ |
388 @DomName('IDBDatabase.abortEvent') | 394 @DomName('IDBDatabase.abortEvent') |
389 @DocsEditable() | 395 @DocsEditable() |
390 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 396 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); |
391 | 397 |
| 398 /** |
| 399 * Static factory designed to expose `close` events to event |
| 400 * handlers that are not necessarily instances of [Database]. |
| 401 * |
| 402 * See [EventStreamProvider] for usage information. |
| 403 */ |
392 @DomName('IDBDatabase.closeEvent') | 404 @DomName('IDBDatabase.closeEvent') |
393 @DocsEditable() | 405 @DocsEditable() |
394 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 | 406 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 |
395 @Experimental() | 407 @Experimental() |
396 static const EventStreamProvider<Event> closeEvent = const EventStreamProvider
<Event>('close'); | 408 static const EventStreamProvider<Event> closeEvent = const EventStreamProvider
<Event>('close'); |
397 | 409 |
| 410 /** |
| 411 * Static factory designed to expose `error` events to event |
| 412 * handlers that are not necessarily instances of [Database]. |
| 413 * |
| 414 * See [EventStreamProvider] for usage information. |
| 415 */ |
398 @DomName('IDBDatabase.errorEvent') | 416 @DomName('IDBDatabase.errorEvent') |
399 @DocsEditable() | 417 @DocsEditable() |
400 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 418 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
401 | 419 |
| 420 /** |
| 421 * Static factory designed to expose `versionchange` events to event |
| 422 * handlers that are not necessarily instances of [Database]. |
| 423 * |
| 424 * See [EventStreamProvider] for usage information. |
| 425 */ |
402 @DomName('IDBDatabase.versionchangeEvent') | 426 @DomName('IDBDatabase.versionchangeEvent') |
403 @DocsEditable() | 427 @DocsEditable() |
404 static const EventStreamProvider<VersionChangeEvent> versionChangeEvent = cons
t EventStreamProvider<VersionChangeEvent>('versionchange'); | 428 static const EventStreamProvider<VersionChangeEvent> versionChangeEvent = cons
t EventStreamProvider<VersionChangeEvent>('versionchange'); |
405 | 429 |
406 @DomName('IDBDatabase.name') | 430 @DomName('IDBDatabase.name') |
407 @DocsEditable() | 431 @DocsEditable() |
408 final String name; | 432 final String name; |
409 | 433 |
410 @DomName('IDBDatabase.objectStoreNames') | 434 @DomName('IDBDatabase.objectStoreNames') |
411 @DocsEditable() | 435 @DocsEditable() |
(...skipping 26 matching lines...) Expand all Loading... |
438 ObjectStore _createObjectStore_1(name, options) native; | 462 ObjectStore _createObjectStore_1(name, options) native; |
439 @JSName('createObjectStore') | 463 @JSName('createObjectStore') |
440 @DomName('IDBDatabase.createObjectStore') | 464 @DomName('IDBDatabase.createObjectStore') |
441 @DocsEditable() | 465 @DocsEditable() |
442 ObjectStore _createObjectStore_2(name) native; | 466 ObjectStore _createObjectStore_2(name) native; |
443 | 467 |
444 @DomName('IDBDatabase.deleteObjectStore') | 468 @DomName('IDBDatabase.deleteObjectStore') |
445 @DocsEditable() | 469 @DocsEditable() |
446 void deleteObjectStore(String name) native; | 470 void deleteObjectStore(String name) native; |
447 | 471 |
| 472 /// Stream of `abort` events handled by this [Database]. |
448 @DomName('IDBDatabase.onabort') | 473 @DomName('IDBDatabase.onabort') |
449 @DocsEditable() | 474 @DocsEditable() |
450 Stream<Event> get onAbort => abortEvent.forTarget(this); | 475 Stream<Event> get onAbort => abortEvent.forTarget(this); |
451 | 476 |
| 477 /// Stream of `close` events handled by this [Database]. |
452 @DomName('IDBDatabase.onclose') | 478 @DomName('IDBDatabase.onclose') |
453 @DocsEditable() | 479 @DocsEditable() |
454 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 | 480 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 |
455 @Experimental() | 481 @Experimental() |
456 Stream<Event> get onClose => closeEvent.forTarget(this); | 482 Stream<Event> get onClose => closeEvent.forTarget(this); |
457 | 483 |
| 484 /// Stream of `error` events handled by this [Database]. |
458 @DomName('IDBDatabase.onerror') | 485 @DomName('IDBDatabase.onerror') |
459 @DocsEditable() | 486 @DocsEditable() |
460 Stream<Event> get onError => errorEvent.forTarget(this); | 487 Stream<Event> get onError => errorEvent.forTarget(this); |
461 | 488 |
| 489 /// Stream of `versionchange` events handled by this [Database]. |
462 @DomName('IDBDatabase.onversionchange') | 490 @DomName('IDBDatabase.onversionchange') |
463 @DocsEditable() | 491 @DocsEditable() |
464 Stream<VersionChangeEvent> get onVersionChange => versionChangeEvent.forTarget
(this); | 492 Stream<VersionChangeEvent> get onVersionChange => versionChangeEvent.forTarget
(this); |
465 } | 493 } |
466 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 494 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
467 // for details. All rights reserved. Use of this source code is governed by a | 495 // for details. All rights reserved. Use of this source code is governed by a |
468 // BSD-style license that can be found in the LICENSE file. | 496 // BSD-style license that can be found in the LICENSE file. |
469 | 497 |
470 | 498 |
471 @DomName('IDBFactory') | 499 @DomName('IDBFactory') |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 // BSD-style license that can be found in the LICENSE file. | 1184 // BSD-style license that can be found in the LICENSE file. |
1157 | 1185 |
1158 | 1186 |
1159 @DocsEditable() | 1187 @DocsEditable() |
1160 @DomName('IDBOpenDBRequest') | 1188 @DomName('IDBOpenDBRequest') |
1161 @Unstable() | 1189 @Unstable() |
1162 class OpenDBRequest extends Request native "IDBOpenDBRequest,IDBVersionChangeReq
uest" { | 1190 class OpenDBRequest extends Request native "IDBOpenDBRequest,IDBVersionChangeReq
uest" { |
1163 // To suppress missing implicit constructor warnings. | 1191 // To suppress missing implicit constructor warnings. |
1164 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); } | 1192 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); } |
1165 | 1193 |
| 1194 /** |
| 1195 * Static factory designed to expose `blocked` events to event |
| 1196 * handlers that are not necessarily instances of [OpenDBRequest]. |
| 1197 * |
| 1198 * See [EventStreamProvider] for usage information. |
| 1199 */ |
1166 @DomName('IDBOpenDBRequest.blockedEvent') | 1200 @DomName('IDBOpenDBRequest.blockedEvent') |
1167 @DocsEditable() | 1201 @DocsEditable() |
1168 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); | 1202 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid
er<Event>('blocked'); |
1169 | 1203 |
| 1204 /** |
| 1205 * Static factory designed to expose `upgradeneeded` events to event |
| 1206 * handlers that are not necessarily instances of [OpenDBRequest]. |
| 1207 * |
| 1208 * See [EventStreamProvider] for usage information. |
| 1209 */ |
1170 @DomName('IDBOpenDBRequest.upgradeneededEvent') | 1210 @DomName('IDBOpenDBRequest.upgradeneededEvent') |
1171 @DocsEditable() | 1211 @DocsEditable() |
1172 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); | 1212 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons
t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); |
1173 | 1213 |
| 1214 /// Stream of `blocked` events handled by this [OpenDBRequest]. |
1174 @DomName('IDBOpenDBRequest.onblocked') | 1215 @DomName('IDBOpenDBRequest.onblocked') |
1175 @DocsEditable() | 1216 @DocsEditable() |
1176 Stream<Event> get onBlocked => blockedEvent.forTarget(this); | 1217 Stream<Event> get onBlocked => blockedEvent.forTarget(this); |
1177 | 1218 |
| 1219 /// Stream of `upgradeneeded` events handled by this [OpenDBRequest]. |
1178 @DomName('IDBOpenDBRequest.onupgradeneeded') | 1220 @DomName('IDBOpenDBRequest.onupgradeneeded') |
1179 @DocsEditable() | 1221 @DocsEditable() |
1180 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); | 1222 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget
(this); |
1181 } | 1223 } |
1182 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1224 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
1183 // for details. All rights reserved. Use of this source code is governed by a | 1225 // for details. All rights reserved. Use of this source code is governed by a |
1184 // BSD-style license that can be found in the LICENSE file. | 1226 // BSD-style license that can be found in the LICENSE file. |
1185 | 1227 |
1186 | 1228 |
1187 @DocsEditable() | 1229 @DocsEditable() |
1188 @DomName('IDBRequest') | 1230 @DomName('IDBRequest') |
1189 @Unstable() | 1231 @Unstable() |
1190 class Request extends EventTarget native "IDBRequest" { | 1232 class Request extends EventTarget native "IDBRequest" { |
1191 // To suppress missing implicit constructor warnings. | 1233 // To suppress missing implicit constructor warnings. |
1192 factory Request._() { throw new UnsupportedError("Not supported"); } | 1234 factory Request._() { throw new UnsupportedError("Not supported"); } |
1193 | 1235 |
| 1236 /** |
| 1237 * Static factory designed to expose `error` events to event |
| 1238 * handlers that are not necessarily instances of [Request]. |
| 1239 * |
| 1240 * See [EventStreamProvider] for usage information. |
| 1241 */ |
1194 @DomName('IDBRequest.errorEvent') | 1242 @DomName('IDBRequest.errorEvent') |
1195 @DocsEditable() | 1243 @DocsEditable() |
1196 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1244 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
1197 | 1245 |
| 1246 /** |
| 1247 * Static factory designed to expose `success` events to event |
| 1248 * handlers that are not necessarily instances of [Request]. |
| 1249 * |
| 1250 * See [EventStreamProvider] for usage information. |
| 1251 */ |
1198 @DomName('IDBRequest.successEvent') | 1252 @DomName('IDBRequest.successEvent') |
1199 @DocsEditable() | 1253 @DocsEditable() |
1200 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); | 1254 static const EventStreamProvider<Event> successEvent = const EventStreamProvid
er<Event>('success'); |
1201 | 1255 |
1202 @DomName('IDBRequest.error') | 1256 @DomName('IDBRequest.error') |
1203 @DocsEditable() | 1257 @DocsEditable() |
1204 final DomError error; | 1258 final DomError error; |
1205 | 1259 |
1206 @DomName('IDBRequest.readyState') | 1260 @DomName('IDBRequest.readyState') |
1207 @DocsEditable() | 1261 @DocsEditable() |
(...skipping 10 matching lines...) Expand all Loading... |
1218 | 1272 |
1219 @DomName('IDBRequest.source') | 1273 @DomName('IDBRequest.source') |
1220 @DocsEditable() | 1274 @DocsEditable() |
1221 @Creates('Null') | 1275 @Creates('Null') |
1222 final dynamic source; | 1276 final dynamic source; |
1223 | 1277 |
1224 @DomName('IDBRequest.transaction') | 1278 @DomName('IDBRequest.transaction') |
1225 @DocsEditable() | 1279 @DocsEditable() |
1226 final Transaction transaction; | 1280 final Transaction transaction; |
1227 | 1281 |
| 1282 /// Stream of `error` events handled by this [Request]. |
1228 @DomName('IDBRequest.onerror') | 1283 @DomName('IDBRequest.onerror') |
1229 @DocsEditable() | 1284 @DocsEditable() |
1230 Stream<Event> get onError => errorEvent.forTarget(this); | 1285 Stream<Event> get onError => errorEvent.forTarget(this); |
1231 | 1286 |
| 1287 /// Stream of `success` events handled by this [Request]. |
1232 @DomName('IDBRequest.onsuccess') | 1288 @DomName('IDBRequest.onsuccess') |
1233 @DocsEditable() | 1289 @DocsEditable() |
1234 Stream<Event> get onSuccess => successEvent.forTarget(this); | 1290 Stream<Event> get onSuccess => successEvent.forTarget(this); |
1235 } | 1291 } |
1236 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1292 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
1237 // for details. All rights reserved. Use of this source code is governed by a | 1293 // for details. All rights reserved. Use of this source code is governed by a |
1238 // BSD-style license that can be found in the LICENSE file. | 1294 // BSD-style license that can be found in the LICENSE file. |
1239 | 1295 |
1240 | 1296 |
1241 @DomName('IDBTransaction') | 1297 @DomName('IDBTransaction') |
(...skipping 24 matching lines...) Expand all Loading... |
1266 completer.completeError(e); | 1322 completer.completeError(e); |
1267 } | 1323 } |
1268 }); | 1324 }); |
1269 | 1325 |
1270 return completer.future; | 1326 return completer.future; |
1271 } | 1327 } |
1272 | 1328 |
1273 // To suppress missing implicit constructor warnings. | 1329 // To suppress missing implicit constructor warnings. |
1274 factory Transaction._() { throw new UnsupportedError("Not supported"); } | 1330 factory Transaction._() { throw new UnsupportedError("Not supported"); } |
1275 | 1331 |
| 1332 /** |
| 1333 * Static factory designed to expose `abort` events to event |
| 1334 * handlers that are not necessarily instances of [Transaction]. |
| 1335 * |
| 1336 * See [EventStreamProvider] for usage information. |
| 1337 */ |
1276 @DomName('IDBTransaction.abortEvent') | 1338 @DomName('IDBTransaction.abortEvent') |
1277 @DocsEditable() | 1339 @DocsEditable() |
1278 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); | 1340 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider
<Event>('abort'); |
1279 | 1341 |
| 1342 /** |
| 1343 * Static factory designed to expose `complete` events to event |
| 1344 * handlers that are not necessarily instances of [Transaction]. |
| 1345 * |
| 1346 * See [EventStreamProvider] for usage information. |
| 1347 */ |
1280 @DomName('IDBTransaction.completeEvent') | 1348 @DomName('IDBTransaction.completeEvent') |
1281 @DocsEditable() | 1349 @DocsEditable() |
1282 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); | 1350 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); |
1283 | 1351 |
| 1352 /** |
| 1353 * Static factory designed to expose `error` events to event |
| 1354 * handlers that are not necessarily instances of [Transaction]. |
| 1355 * |
| 1356 * See [EventStreamProvider] for usage information. |
| 1357 */ |
1284 @DomName('IDBTransaction.errorEvent') | 1358 @DomName('IDBTransaction.errorEvent') |
1285 @DocsEditable() | 1359 @DocsEditable() |
1286 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); | 1360 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider
<Event>('error'); |
1287 | 1361 |
1288 @DomName('IDBTransaction.db') | 1362 @DomName('IDBTransaction.db') |
1289 @DocsEditable() | 1363 @DocsEditable() |
1290 final Database db; | 1364 final Database db; |
1291 | 1365 |
1292 @DomName('IDBTransaction.error') | 1366 @DomName('IDBTransaction.error') |
1293 @DocsEditable() | 1367 @DocsEditable() |
1294 final DomError error; | 1368 final DomError error; |
1295 | 1369 |
1296 @DomName('IDBTransaction.mode') | 1370 @DomName('IDBTransaction.mode') |
1297 @DocsEditable() | 1371 @DocsEditable() |
1298 final String mode; | 1372 final String mode; |
1299 | 1373 |
1300 @DomName('IDBTransaction.abort') | 1374 @DomName('IDBTransaction.abort') |
1301 @DocsEditable() | 1375 @DocsEditable() |
1302 void abort() native; | 1376 void abort() native; |
1303 | 1377 |
1304 @DomName('IDBTransaction.objectStore') | 1378 @DomName('IDBTransaction.objectStore') |
1305 @DocsEditable() | 1379 @DocsEditable() |
1306 ObjectStore objectStore(String name) native; | 1380 ObjectStore objectStore(String name) native; |
1307 | 1381 |
| 1382 /// Stream of `abort` events handled by this [Transaction]. |
1308 @DomName('IDBTransaction.onabort') | 1383 @DomName('IDBTransaction.onabort') |
1309 @DocsEditable() | 1384 @DocsEditable() |
1310 Stream<Event> get onAbort => abortEvent.forTarget(this); | 1385 Stream<Event> get onAbort => abortEvent.forTarget(this); |
1311 | 1386 |
| 1387 /// Stream of `complete` events handled by this [Transaction]. |
1312 @DomName('IDBTransaction.oncomplete') | 1388 @DomName('IDBTransaction.oncomplete') |
1313 @DocsEditable() | 1389 @DocsEditable() |
1314 Stream<Event> get onComplete => completeEvent.forTarget(this); | 1390 Stream<Event> get onComplete => completeEvent.forTarget(this); |
1315 | 1391 |
| 1392 /// Stream of `error` events handled by this [Transaction]. |
1316 @DomName('IDBTransaction.onerror') | 1393 @DomName('IDBTransaction.onerror') |
1317 @DocsEditable() | 1394 @DocsEditable() |
1318 Stream<Event> get onError => errorEvent.forTarget(this); | 1395 Stream<Event> get onError => errorEvent.forTarget(this); |
1319 | 1396 |
1320 } | 1397 } |
1321 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1398 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
1322 // for details. All rights reserved. Use of this source code is governed by a | 1399 // for details. All rights reserved. Use of this source code is governed by a |
1323 // BSD-style license that can be found in the LICENSE file. | 1400 // BSD-style license that can be found in the LICENSE file. |
1324 | 1401 |
1325 | 1402 |
(...skipping 26 matching lines...) Expand all Loading... |
1352 // BSD-style license that can be found in the LICENSE file. | 1429 // BSD-style license that can be found in the LICENSE file. |
1353 | 1430 |
1354 | 1431 |
1355 @DocsEditable() | 1432 @DocsEditable() |
1356 @DomName('IDBAny') | 1433 @DomName('IDBAny') |
1357 @deprecated // nonstandard | 1434 @deprecated // nonstandard |
1358 abstract class _IDBAny extends Interceptor native "IDBAny" { | 1435 abstract class _IDBAny extends Interceptor native "IDBAny" { |
1359 // To suppress missing implicit constructor warnings. | 1436 // To suppress missing implicit constructor warnings. |
1360 factory _IDBAny._() { throw new UnsupportedError("Not supported"); } | 1437 factory _IDBAny._() { throw new UnsupportedError("Not supported"); } |
1361 } | 1438 } |
OLD | NEW |