Skip to content

Instantly share code, notes, and snippets.

@JBreit
Created February 7, 2016 13:08
Show Gist options
  • Save JBreit/26649ccc5fca9edeb269 to your computer and use it in GitHub Desktop.
Save JBreit/26649ccc5fca9edeb269 to your computer and use it in GitHub Desktop.
var Storage = (function (name) {
if (supportLocalStorage) {
var self = window['localStorage'];
if (!localStorage[name]) {
localStorage.ApplicationStorage = localStorage[name];
localStorage.ApplicationStorage.users = localStorage.setItem('ApplicationStorage', 'Users');
}
console.log(self);
document.write(localStorage + '<br>');
document.write(localStorage.ApplicationStorage);
} else {
console.log('Sorry but your browser does not support window.localStorage.');
}
function supportLocalStorage () {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
}(Storage || {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment