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

Side by Side Diff: tools/dom/templates/html/impl/impl_Storage.darttemplate

Issue 12219002: 'Moved all documentation from old .dartdoc files.' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate ('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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /**
8 * The type used by the
9 * [Window.localStorage] and [Window.sessionStorage] properties.
10 * Storage is implemented as a Map<String, String>.
11 *
12 * To store and get values, use Dart's built-in map syntax:
13 *
14 * window.localStorage['key1'] = 'val1';
15 * window.localStorage['key2'] = 'val2';
16 * window.localStorage['key3'] = 'val3';
17 * assert(window.localStorage['key3'] == 'val3');
18 *
19 * You can use [Map](http://api.dartlang.org/dart_core/Map.html) APIs
20 * such as containsValue(), clear(), and length:
21 *
22 * assert(window.localStorage.containsValue('does not exist') == false);
23 * window.localStorage.clear();
24 * assert(window.localStorage.length == 0);
25 *
26 * For more examples of using this API, see
27 * [localstorage_test.dart](http://code.google.com/p/dart/source/browse/branches /bleeding_edge/dart/tests/html/localstorage_test.dart).
28 * For details on using the Map API, see the
29 * [Maps](http://www.dartlang.org/docs/library-tour/#maps-aka-dictionaries-or-ha shes)
30 * section of the library tour.
31 */
7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS implements Map<String, String> 32 $(ANNOTATIONS)class $CLASSNAME$EXTENDS implements Map<String, String>
8 $NATIVESPEC { 33 $NATIVESPEC {
9 34
10 // TODO(nweiz): update this when maps support lazy iteration 35 // TODO(nweiz): update this when maps support lazy iteration
11 bool containsValue(String value) => values.any((e) => e == value); 36 bool containsValue(String value) => values.any((e) => e == value);
12 37
13 bool containsKey(String key) => $dom_getItem(key) != null; 38 bool containsKey(String key) => $dom_getItem(key) != null;
14 39
15 String operator [](String key) => $dom_getItem(key); 40 String operator [](String key) => $dom_getItem(key);
16 41
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 final values = []; 73 final values = [];
49 forEach((k, v) => values.add(v)); 74 forEach((k, v) => values.add(v));
50 return values; 75 return values;
51 } 76 }
52 77
53 int get length => $dom_length; 78 int get length => $dom_length;
54 79
55 bool get isEmpty => $dom_key(0) == null; 80 bool get isEmpty => $dom_key(0) == null;
56 $!MEMBERS 81 $!MEMBERS
57 } 82 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698