diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2016-02-11 23:55:16 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2016-02-11 23:55:16 +0100 |
| commit | 29aaea2d80a9eb1715b6cddfac2d2aacf76358bd (patch) | |
| tree | 012795b6bec16c72f38d33cff46324c9a0225868 /rockworkd/libpebble/jskit/cacheLocalStorage.js | |
launchpad ~mzanetti/rockwork/trunk r87
Diffstat (limited to 'rockworkd/libpebble/jskit/cacheLocalStorage.js')
| -rw-r--r-- | rockworkd/libpebble/jskit/cacheLocalStorage.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rockworkd/libpebble/jskit/cacheLocalStorage.js b/rockworkd/libpebble/jskit/cacheLocalStorage.js new file mode 100644 index 0000000..22588a9 --- /dev/null +++ b/rockworkd/libpebble/jskit/cacheLocalStorage.js @@ -0,0 +1,11 @@ +//Since we don't have JS 6 support, this hack will allow us to save changes to localStorage when using dot or square bracket notation + +for (var key in localStorage) { + _jskit.localstorage.setItem(key, localStorage.getItem(key)); +} + +for (var key in _jskit.localstorage.keys()) { + if (localStorage[key] === undefined) { + _jskit.localstorage.removeItem(key); + } +} |
