| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /// @domName Storage | |
| 6 /** | |
| 7 * The type used by the | |
| 8 * [Window.localStorage] and [Window.sessionStorage] properties. | |
| 9 * Storage is implemented as a Map<String, String>. | |
| 10 * | |
| 11 * To store and get values, use Dart's built-in map syntax: | |
| 12 * | |
| 13 * window.localStorage['key1'] = 'val1'; | |
| 14 * window.localStorage['key2'] = 'val2'; | |
| 15 * window.localStorage['key3'] = 'val3'; | |
| 16 * assert(window.localStorage['key3'] == 'val3'); | |
| 17 * | |
| 18 * You can use [Map](http://api.dartlang.org/dart_core/Map.html) APIs | |
| 19 * such as containsValue(), clear(), and length: | |
| 20 * | |
| 21 * assert(window.localStorage.containsValue('does not exist') == false); | |
| 22 * window.localStorage.clear(); | |
| 23 * assert(window.localStorage.length == 0); | |
| 24 * | |
| 25 * For more examples of using this API, see | |
| 26 * [localstorage_test.dart](http://code.google.com/p/dart/source/browse/branches
/bleeding_edge/dart/tests/html/localstorage_test.dart). | |
| 27 * For details on using the Map API, see the | |
| 28 * [Maps](http://www.dartlang.org/docs/library-tour/#maps-aka-dictionaries-or-ha
shes) | |
| 29 * section of the library tour. | |
| 30 * | |
| 31 */ | |
| 32 abstract class Storage implements Map<String, String> { | |
| 33 | |
| 34 /** @domName Storage.length */ | |
| 35 abstract int get $dom_length; | |
| 36 | |
| 37 /** @domName Storage.clear */ | |
| 38 void $dom_clear(); | |
| 39 | |
| 40 /** @domName Storage.getItem */ | |
| 41 String $dom_getItem(String key); | |
| 42 | |
| 43 /** @domName Storage.key */ | |
| 44 String $dom_key(int index); | |
| 45 | |
| 46 /** @domName Storage.removeItem */ | |
| 47 void $dom_removeItem(String key); | |
| 48 | |
| 49 /** @domName Storage.setItem */ | |
| 50 void $dom_setItem(String key, String data); | |
| 51 | |
| 52 } | |
| OLD | NEW |