Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /** | |
| 2 * A client-side key-value store with support for indexes. | |
| 3 * | |
| 4 * Many browsers provide an indexed database, | |
| 5 * which web apps can use to store data in the client. | |
| 6 * Client-side storage provides apps with | |
| 7 * off-line functionality, better performance, | |
| 8 * and the ability to cache the app's state between invocations. | |
| 9 * To find out which browsers support indexed database, | |
| 10 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) | |
| 11 * | |
| 12 * In an indexed database each record is identified by a unique index or key, | |
| 13 * making data retrieval speedy. | |
| 14 * You can store large amounts of structured data, | |
|
sethladd
2013/08/29 08:16:13
what does "large amounts" mean? That feels sales p
mem
2013/08/29 11:12:35
Done.
| |
| 15 * such as images, arrays, maps, and objects using IndexedDB. | |
|
sethladd
2013/08/29 08:16:13
are we sure about objects? I'm not sure we can sto
mem
2013/08/29 11:12:35
Done.
| |
| 16 * The standard does not specify size limits for individual data items | |
| 17 * or for the database itself, but browsers may impose storage limits. | |
| 18 * | |
| 19 * The classes in this library provide an interface | |
| 20 * to the browser's indexed database, if it has one. | |
| 21 * To use this library in your code: | |
| 22 * | |
| 23 * import 'dart:indexed_db'; | |
| 24 * | |
| 25 * A web app can determine if the browser has an | |
| 26 * indexed database with [IdbFactory.supported]: | |
| 27 * | |
| 28 * if (IdbFactory.supported) | |
| 29 * // Use indexeddb. | |
| 30 * else | |
| 31 * // Find an alternative. | |
| 32 * | |
| 33 * Open an indexed database using the `indexedDB` object | |
| 34 * provided by the top-level [Window] object for the app. | |
| 35 * For example: | |
| 36 * | |
| 37 * Future open() { | |
| 38 * return window.indexedDB.open('myIndexedDB', | |
| 39 * version: 1, | |
| 40 * onUpgradeNeeded: /* Initalize the database. */ ) | |
| 41 * .then( /* Load data from the database. */ ); | |
| 42 * } | |
| 43 * | |
|
sethladd
2013/08/29 08:16:13
since you show opening... are you going to add fin
mem
2013/08/29 11:12:35
Yup. We'll add it later. Adjust the wording so it'
| |
| 44 * ## Other resources | |
|
sethladd
2013/08/29 08:16:13
How about linking to http://docs.webplatform.org/w
mem
2013/08/29 11:12:35
And to lawndart.
Done
On 2013/08/29 08:16:13, set
| |
| 45 * | |
| 46 * Other client-side data stores include: | |
| 47 * | |
| 48 * * [Window.localStorage]—a | |
| 49 * basic mechanism in which data is stored as a [Map]. | |
| 50 * | |
| 51 * * [dart:web_sql]—a database that can be queried with SQL. | |
| 52 * | |
| 53 * For a tutorial about using the indexed_db library, | |
| 54 * check out | |
| 55 * [Use IndexedDB](https://www.dartlang.org/docs/tutorials/indexeddb/). | |
| 56 */ | |
| 1 library dart.dom.indexed_db; | 57 library dart.dom.indexed_db; |
| 2 | 58 |
| 3 import 'dart:async'; | 59 import 'dart:async'; |
| 4 import 'dart:html'; | 60 import 'dart:html'; |
| 5 import 'dart:html_common'; | 61 import 'dart:html_common'; |
| 6 import 'dart:typed_data'; | 62 import 'dart:typed_data'; |
| 7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; | 63 import 'dart:_js_helper' show Creates, Returns, JSName, Null; |
| 8 import 'dart:_foreign_helper' show JS; | 64 import 'dart:_foreign_helper' show JS; |
| 9 import 'dart:_interceptors' show Interceptor, JSExtendableArray; | 65 import 'dart:_interceptors' show Interceptor, JSExtendableArray; |
| 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 66 // 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 | 1325 // 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 | 1326 // 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. | 1327 // BSD-style license that can be found in the LICENSE file. |
| 1272 | 1328 |
| 1273 | 1329 |
| 1274 @DocsEditable() | 1330 @DocsEditable() |
| 1275 @DomName('IDBAny') | 1331 @DomName('IDBAny') |
| 1276 @deprecated // nonstandard | 1332 @deprecated // nonstandard |
| 1277 abstract class _IDBAny extends Interceptor native "IDBAny" { | 1333 abstract class _IDBAny extends Interceptor native "IDBAny" { |
| 1278 } | 1334 } |
| OLD | NEW |