From 5aa551a696fae0277b2325a889138cebb256c343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Lund=C3=A9n?= Date: Thu, 12 Jan 2017 15:32:40 +0100 Subject: [PATCH] Make it possible to set a namespace for localStorage, with fallback to document.location.href. Also prefix with 'dat.gui.' to avoid collisions. --- src/dat/gui/GUI.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dat/gui/GUI.js b/src/dat/gui/GUI.js index e037111..79908c0 100644 --- a/src/dat/gui/GUI.js +++ b/src/dat/gui/GUI.js @@ -1023,8 +1023,8 @@ function add(gui, object, property, params) { } 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 addPresetOption(gui, name, setSelected) {