Chromium Code Reviews| Index: tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate |
| diff --git a/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate b/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate |
| index 4b6314f3df689ede0c820de2ccd7ecbf49ff865b..9d6e49b1132f692889971481d06b15fb1a4eebef 100644 |
| --- a/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate |
| +++ b/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate |
| @@ -6,6 +6,73 @@ |
| // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation |
| // Auto-generated dart:svg library. |
| +/** |
| + * A client-side key-value store with support for indexes. |
| + * |
| + * Many browsers support IndexedDB—a web standard for |
| + * an indexed database. |
| + * By storing data on the client in an IndexedDB, |
| + * a web app gets some advantages, such as faster performance and persistence. |
| + * To find out which browsers support IndexedDB, |
| + * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) |
| + * |
| + * In IndexedDB, each record is identified by a unique index or key, |
| + * making data retrieval speedy. |
| + * You can store structured data, |
| + * such as images, arrays, and maps using IndexedDB. |
| + * The standard does not specify size limits for individual data items |
| + * or for the database itself, but browsers may impose storage limits. |
| + * |
| + * ## Using indexed_db |
| + * |
| + * The classes in this library provide an interface |
| + * to the browser's IndexedDB, if it has one. |
| + * To use this library in your code: |
| + * |
| + * import 'dart:indexed_db'; |
| + * |
| + * A web app can determine if the browser supports |
| + * IndexedDB with [IdbFactory.supported]: |
| + * |
| + * if (IdbFactory.supported) |
| + * // Use indexeddb. |
| + * else |
| + * // Find an alternative. |
| + * |
| + * Access to the browser's IndexedDB is provided by the app's top-level |
| + * [Window] object, which your code can refer to with `window.indexedDB`. |
| + * So, for example, |
| + * to open an indexed database, you would write something like this: |
|
sethladd
2013/08/29 11:26:34
"write something like this" is wishy-washy. How ab
mem
2013/09/03 17:41:06
Done.
|
| + * |
| + * Future open() { |
| + * return window.indexedDB.open('myIndexedDB', |
| + * version: 1, |
| + * onUpgradeNeeded: /* Initalize the database. */ ) |
|
sethladd
2013/08/29 11:26:34
this isn't valid Dart code. Can you fix so that so
mem
2013/09/03 17:41:06
Done.
|
| + * .then( /* Load data from the database. */ ); |
| + * } |
| + * |
| + * All data in an IndexedDB is stored within an [ObjectStore]. |
| + * To manipulate the database use [Transaction]s. |
| + * |
| + * ## Other resources |
| + * |
| + * Other options for client-side data storage include: |
| + * |
| + * * [Window.localStorage]—a |
| + * basic mechanism in which data is stored as a [Map]. |
| + * |
| + * * [dart:web_sql]—a database that can be queried with SQL. |
| + * |
| + * * The [Lawndart](http://pub.dartlang.org/packages/lawndart) package, |
| + * which helps you deal with the wide array of client-side storage options. |
| + * |
| + * For a tutorial about using the indexed_db library with Dart, |
| + * check out |
| + * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/). |
| + * |
| + * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb) |
| + * provides wiki-style docs about indexedDB |
| + */ |
| library dart.dom.indexed_db; |
| import 'dart:async'; |