Skip to content

Instantly share code, notes, and snippets.

@bwhite
Created March 27, 2014 21:14
Show Gist options
  • Save bwhite/9819006 to your computer and use it in GitHub Desktop.
Save bwhite/9819006 to your computer and use it in GitHub Desktop.
[wearscript] Local storage example
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
var key = 'test';
if (localStorage[key]) {
WS.log('Stored Value: ' + localStorage[key]);
} else {
WS.log('New value');
localStorage[key] = 'Local Storage Initialized on ' + (new Date()).toGMTString();
}
//localStorage.removeItem(key);
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment