OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // DO NOT EDIT | 5 // DO NOT EDIT |
6 // Auto-generated dart:indexed_db library. | 6 // Auto-generated dart:indexed_db library. |
7 | 7 |
| 8 /** |
| 9 * A client-side key-value store with support for indexes. |
| 10 * |
| 11 * Many browsers support IndexedDB—a web standard for |
| 12 * an indexed database. |
| 13 * By storing data on the client in an IndexedDB, |
| 14 * a web app gets some advantages, such as faster performance and persistence. |
| 15 * To find out which browsers support IndexedDB, |
| 16 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) |
| 17 * |
| 18 * In IndexedDB, each record is identified by a unique index or key, |
| 19 * making data retrieval speedy. |
| 20 * You can store structured data, |
| 21 * such as images, arrays, and maps using IndexedDB. |
| 22 * The standard does not specify size limits for individual data items |
| 23 * or for the database itself, but browsers may impose storage limits. |
| 24 * |
| 25 * ## Using indexed_db |
| 26 * |
| 27 * The classes in this library provide an interface |
| 28 * to the browser's IndexedDB, if it has one. |
| 29 * To use this library in your code: |
| 30 * |
| 31 * import 'dart:indexed_db'; |
| 32 * |
| 33 * A web app can determine if the browser supports |
| 34 * IndexedDB with [IdbFactory.supported]: |
| 35 * |
| 36 * if (IdbFactory.supported) |
| 37 * // Use indexeddb. |
| 38 * else |
| 39 * // Find an alternative. |
| 40 * |
| 41 * Access to the browser's IndexedDB is provided by the app's top-level |
| 42 * [Window] object, which your code can refer to with `window.indexedDB`. |
| 43 * So, for example, |
| 44 * here's how to use window.indexedDB to open a database: |
| 45 * |
| 46 * Future open() { |
| 47 * return window.indexedDB.open('myIndexedDB', |
| 48 * version: 1, |
| 49 * onUpgradeNeeded: _initializeDatabase) |
| 50 * .then(_loadFromDB); |
| 51 * } |
| 52 * void _initializeDatabase(VersionChangeEvent e) { |
| 53 * ... |
| 54 * } |
| 55 * Future _loadFromDB(Database db) { |
| 56 * ... |
| 57 * } |
| 58 * |
| 59 * |
| 60 * All data in an IndexedDB is stored within an [ObjectStore]. |
| 61 * To manipulate the database use [Transaction]s. |
| 62 * |
| 63 * ## Other resources |
| 64 * |
| 65 * Other options for client-side data storage include: |
| 66 * |
| 67 * * [Window.localStorage]—a |
| 68 * basic mechanism that stores data as a [Map], |
| 69 * and where both the keys and the values are strings. |
| 70 * |
| 71 * * [dart:web_sql]—a database that can be queried with SQL. |
| 72 * |
| 73 * For a tutorial about using the indexed_db library with Dart, |
| 74 * check out |
| 75 * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/). |
| 76 * |
| 77 * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb) |
| 78 * provides wiki-style docs about indexedDB |
| 79 */ |
8 library dart.dom.indexed_db; | 80 library dart.dom.indexed_db; |
9 | 81 |
10 import 'dart:async'; | 82 import 'dart:async'; |
11 import 'dart:html'; | 83 import 'dart:html'; |
12 import 'dart:html_common'; | 84 import 'dart:html_common'; |
13 import 'dart:nativewrappers'; | 85 import 'dart:nativewrappers'; |
14 import 'dart:_blink' as _blink; | 86 import 'dart:_blink' as _blink; |
15 | 87 |
16 $!GENERATED_DART_FILES | 88 $!GENERATED_DART_FILES |
17 | 89 |
(...skipping 12 matching lines...) Expand all Loading... |
30 | 102 |
31 static KeyRange createKeyRange_bound( | 103 static KeyRange createKeyRange_bound( |
32 /*IDBKey*/ lower, /*IDBKey*/ upper, | 104 /*IDBKey*/ lower, /*IDBKey*/ upper, |
33 [bool lowerOpen = false, bool upperOpen = false]) => | 105 [bool lowerOpen = false, bool upperOpen = false]) => |
34 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); | 106 KeyRange.bound_(lower, upper, lowerOpen, upperOpen); |
35 } | 107 } |
36 // FIXME: Can we make this private? | 108 // FIXME: Can we make this private? |
37 final indexed_dbBlinkMap = { | 109 final indexed_dbBlinkMap = { |
38 $!TYPE_MAP | 110 $!TYPE_MAP |
39 }; | 111 }; |
OLD | NEW |