From 8ea07bc911f1abbba59ff87523da02c7025c1d84 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Thu, 2 Feb 2012 16:46:21 -0800 Subject: [PATCH] Fixed: persist client-side variant again. Closes #9 --- debug.js | 7 +++++++ example/browser.html | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debug.js b/debug.js index eca5ef4..3d4fbea 100644 --- a/debug.js +++ b/debug.js @@ -40,6 +40,7 @@ function debug(name) { */ debug.names = []; + /** * Enables a debug mode by name. This can include modes * separated by a colon and wildcards. @@ -49,6 +50,8 @@ debug.names = []; */ debug.enable = function(name) { + localStorage.debug = name; + var split = (name || '').split(/[\s,]+/) , len = split.length; @@ -74,3 +77,7 @@ debug.enabled = function(name) { } return false; }; + +// persist + +if (window.localStorage) debug.enable(localStorage.debug); \ No newline at end of file diff --git a/example/browser.html b/example/browser.html index ae32c60..7510eee 100644 --- a/example/browser.html +++ b/example/browser.html @@ -3,7 +3,8 @@ debug()