Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate

Issue 23681003: added library-level description for dart:indexed_db (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: removed reference to lawndart, clarified local storage Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 - unless you are editing documentation as per: 5 // DO NOT EDIT - unless you are editing documentation as per:
6 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation 6 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
7 // Auto-generated dart:svg library. 7 // Auto-generated dart:svg library.
8 8
9 /**
10 * A client-side key-value store with support for indexes.
11 *
12 * Many browsers support IndexedDB—a web standard for
13 * an indexed database.
14 * By storing data on the client in an IndexedDB,
15 * a web app gets some advantages, such as faster performance and persistence.
16 * To find out which browsers support IndexedDB,
17 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb)
18 *
19 * In IndexedDB, each record is identified by a unique index or key,
20 * making data retrieval speedy.
21 * You can store structured data,
22 * such as images, arrays, and maps using IndexedDB.
23 * The standard does not specify size limits for individual data items
24 * or for the database itself, but browsers may impose storage limits.
25 *
26 * ## Using indexed_db
27 *
28 * The classes in this library provide an interface
29 * to the browser's IndexedDB, if it has one.
30 * To use this library in your code:
31 *
32 * import 'dart:indexed_db';
33 *
34 * A web app can determine if the browser supports
35 * IndexedDB with [IdbFactory.supported]:
36 *
37 * if (IdbFactory.supported)
38 * // Use indexeddb.
39 * else
40 * // Find an alternative.
41 *
42 * Access to the browser's IndexedDB is provided by the app's top-level
43 * [Window] object, which your code can refer to with `window.indexedDB`.
44 * So, for example,
45 * here's how to use window.indexedDB to open a database:
46 *
47 * Future open() {
48 * return window.indexedDB.open('myIndexedDB',
49 * version: 1,
50 * onUpgradeNeeded: _initializeDatabase)
51 * .then(_loadFromDB);
52 * }
53 * void _initializeDatabase(VersionChangeEvent e) {
54 * ...
55 * }
56 * Future _loadFromDB(Database db) {
57 * ...
58 * }
59 *
60 *
61 * All data in an IndexedDB is stored within an [ObjectStore].
62 * To manipulate the database use [Transaction]s.
63 *
64 * ## Other resources
65 *
66 * Other options for client-side data storage include:
67 *
68 * * [Window.localStorage]—a
69 * basic mechanism that stores data as a [Map],
70 * and where both the keys and the values are strings.
71 *
72 * * [dart:web_sql]—a database that can be queried with SQL.
73 *
74 * For a tutorial about using the indexed_db library with Dart,
75 * check out
76 * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/).
77 *
78 * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb)
79 * provides wiki-style docs about indexedDB
80 */
9 library dart.dom.indexed_db; 81 library dart.dom.indexed_db;
10 82
11 import 'dart:async'; 83 import 'dart:async';
12 import 'dart:html'; 84 import 'dart:html';
13 import 'dart:html_common'; 85 import 'dart:html_common';
14 import 'dart:typed_data'; 86 import 'dart:typed_data';
15 import 'dart:_js_helper' show Creates, Returns, JSName, Null; 87 import 'dart:_js_helper' show Creates, Returns, JSName, Null;
16 import 'dart:_foreign_helper' show JS; 88 import 'dart:_foreign_helper' show JS;
17 import 'dart:_interceptors' show Interceptor, JSExtendableArray; 89 import 'dart:_interceptors' show Interceptor, JSExtendableArray;
18 90
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 197
126 /// May modify original. If so, action is idempotent. 198 /// May modify original. If so, action is idempotent.
127 _convertNativeToDart_IDBAny(object) { 199 _convertNativeToDart_IDBAny(object) {
128 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false); 200 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false);
129 } 201 }
130 202
131 // TODO(sra): Add DateTime. 203 // TODO(sra): Add DateTime.
132 const String _idbKey = 'JSExtendableArray|=Object|num|String'; 204 const String _idbKey = 'JSExtendableArray|=Object|num|String';
133 const _annotation_Creates_IDBKey = const Creates(_idbKey); 205 const _annotation_Creates_IDBKey = const Creates(_idbKey);
134 const _annotation_Returns_IDBKey = const Returns(_idbKey); 206 const _annotation_Returns_IDBKey = const Returns(_idbKey);
OLDNEW
« no previous file with comments | « sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698