Make it possible to override localStorage namespace, falling back to the old bad default for now

This commit is contained in:
kristoffer 2016-07-08 16:09:05 +02:00
parent 794427af09
commit a7751512ff
2 changed files with 6 additions and 6 deletions

View File

@ -2604,11 +2604,11 @@ dat.GUI = dat.gui.GUI = (function (css, saveDialogueContents, styleSheet, contro
}
function getLocalStorageHash(gui, key) {
// TODO how does this deal with multiple GUI's?
return document.location.href + '.' + key;
var namespace = localStorage.getItem('dat.gui.namespace') || document.location.href;
return 'dat.gui.' + namespace + '.' + key;
}
function addSaveMenu(gui) {
var div = gui.__save_row = document.createElement('li');

View File

@ -1109,11 +1109,11 @@ define([
}
function getLocalStorageHash(gui, key) {
// TODO how does this deal with multiple GUI's?
return document.location.href + '.' + key;
var namespace = localStorage.getItem('dat.gui.namespace') || document.location.href;
return 'dat.gui.' + namespace + '.' + key;
}
function addSaveMenu(gui) {
var div = gui.__save_row = document.createElement('li');