| OLD | NEW |
| 1 /** |
| 2 * A client-side key-value store with support for indexes. |
| 3 * |
| 4 * Many browsers support IndexedDB—a web standard for |
| 5 * an indexed database. |
| 6 * By storing data on the client in an IndexedDB, |
| 7 * a web app gets some advantages, such as faster performance and persistence. |
| 8 * To find out which browsers support IndexedDB, |
| 9 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) |
| 10 * |
| 11 * In IndexedDB, each record is identified by a unique index or key, |
| 12 * making data retrieval speedy. |
| 13 * You can store structured data, |
| 14 * such as images, arrays, and maps using IndexedDB. |
| 15 * The standard does not specify size limits for individual data items |
| 16 * or for the database itself, but browsers may impose storage limits. |
| 17 * |
| 18 * ## Using indexed_db |
| 19 * |
| 20 * The classes in this library provide an interface |
| 21 * to the browser's IndexedDB, if it has one. |
| 22 * To use this library in your code: |
| 23 * |
| 24 * import 'dart:indexed_db'; |
| 25 * |
| 26 * A web app can determine if the browser supports |
| 27 * IndexedDB with [IdbFactory.supported]: |
| 28 * |
| 29 * if (IdbFactory.supported) |
| 30 * // Use indexeddb. |
| 31 * else |
| 32 * // Find an alternative. |
| 33 * |
| 34 * Access to the browser's IndexedDB is provided by the app's top-level |
| 35 * [Window] object, which your code can refer to with `window.indexedDB`. |
| 36 * So, for example, |
| 37 * to open an indexed database, you would write something like this: |
| 38 * |
| 39 * Future open() { |
| 40 * return window.indexedDB.open('myIndexedDB', |
| 41 * version: 1, |
| 42 * onUpgradeNeeded: /* Initalize the database. */ ) |
| 43 * .then( /* Load data from the database. */ ); |
| 44 * } |
| 45 * |
| 46 * All data in an IndexedDB is stored within an [ObjectStore]. |
| 47 * To manipulate the database use [Transaction]s. |
| 48 * |
| 49 * ## Other resources |
| 50 * |
| 51 * Other client-side data stores include: |
| 52 * |
| 53 * * [Window.localStorage]—a |
| 54 * basic mechanism in which data is stored as a [Map]. |
| 55 * |
| 56 * * [dart:web_sql]—a database that can be queried with SQL. |
| 57 * |
| 58 * * The [Lawndart](http://pub.dartlang.org/packages/lawndart) package, |
| 59 * which helps you deal with the wide array of client-side storage options. |
| 60 * |
| 61 * For a tutorial about using the indexed_db library with Dart, |
| 62 * check out |
| 63 * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/). |
| 64 * |
| 65 * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb) |
| 66 * provides wiki-style docs about indexedDB |
| 67 */ |
| 1 library dart.dom.indexed_db; | 68 library dart.dom.indexed_db; |
| 2 | 69 |
| 3 import 'dart:async'; | 70 import 'dart:async'; |
| 4 import 'dart:html'; | 71 import 'dart:html'; |
| 5 import 'dart:html_common'; | 72 import 'dart:html_common'; |
| 6 import 'dart:typed_data'; | 73 import 'dart:typed_data'; |
| 7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; | 74 import 'dart:_js_helper' show Creates, Returns, JSName, Null; |
| 8 import 'dart:_foreign_helper' show JS; | 75 import 'dart:_foreign_helper' show JS; |
| 9 import 'dart:_interceptors' show Interceptor, JSExtendableArray; | 76 import 'dart:_interceptors' show Interceptor, JSExtendableArray; |
| 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 77 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1336 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1270 // for details. All rights reserved. Use of this source code is governed by a | 1337 // for details. All rights reserved. Use of this source code is governed by a |
| 1271 // BSD-style license that can be found in the LICENSE file. | 1338 // BSD-style license that can be found in the LICENSE file. |
| 1272 | 1339 |
| 1273 | 1340 |
| 1274 @DocsEditable() | 1341 @DocsEditable() |
| 1275 @DomName('IDBAny') | 1342 @DomName('IDBAny') |
| 1276 @deprecated // nonstandard | 1343 @deprecated // nonstandard |
| 1277 abstract class _IDBAny extends Interceptor native "IDBAny" { | 1344 abstract class _IDBAny extends Interceptor native "IDBAny" { |
| 1278 } | 1345 } |
| OLD | NEW |