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 class _StorageJs extends _DOMTypeJs implements Storage native "*Storage" { | |
6 | |
7 final int length; | |
8 | |
9 void clear() native; | |
10 | |
11 String getItem(String key) native; | |
12 | |
13 String key(int index) native; | |
14 | |
15 void removeItem(String key) native; | |
16 | |
17 void setItem(String key, String data) native; | |
18 | |
19 | |
20 // Storage needs a special implementation of dartObjectLocalStorage since it | |
21 // captures what would normally be an expando and places property in the | |
22 // storage, stringifying the assigned value. | |
23 | |
24 get dartObjectLocalStorage() native """ | |
25 if (this === window.localStorage) | |
26 return window._dartLocalStorageLocalStorage; | |
27 else if (this === window.sessionStorage) | |
28 return window._dartSessionStorageLocalStorage; | |
29 else | |
30 throw new UnsupportedOperationException('Cannot dartObjectLocalStorage for
unknown Storage object.'); | |
31 """ { throw new UnsupportedOperationException(''); } | |
32 | |
33 void set dartObjectLocalStorage(var value) native """ | |
34 if (this === window.localStorage) | |
35 window._dartLocalStorageLocalStorage = value; | |
36 else if (this === window.sessionStorage) | |
37 window._dartSessionStorageLocalStorage = value; | |
38 else | |
39 throw new UnsupportedOperationException('Cannot dartObjectLocalStorage for
unknown Storage object.'); | |
40 """ { throw new UnsupportedOperationException(''); } | |
41 } | |
OLD | NEW |