From cb004bf07eefd50c3f19364355c5421d2b85551f Mon Sep 17 00:00:00 2001 From: Fabian Irsara Date: Tue, 1 Dec 2015 22:41:54 +0100 Subject: [PATCH] fix error when removing event --- src/dat/gui/GUI.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dat/gui/GUI.js b/src/dat/gui/GUI.js index 024eaa0..3b8b199 100644 --- a/src/dat/gui/GUI.js +++ b/src/dat/gui/GUI.js @@ -563,9 +563,12 @@ define([ } dom.unbind(window, 'keydown', _keydownHandler, false); - dom.unbind(window, 'unload', saveToLocalStorage); dom.unbind(window, 'resize', _resizeHandler); + if (saveToLocalStorage) { + dom.unbind(window, 'unload', saveToLocalStorage); + } + }, /**