Permalink
Browse files

Fixed: persist client-side variant again. Closes #9

  • Loading branch information...
1 parent 1335463 commit 8ea07bc911f1abbba59ff87523da02c7025c1d84 @tj tj committed Feb 3, 2012
Showing with 9 additions and 1 deletion.
  1. +7 −0 debug.js
  2. +2 −1 example/browser.html
View
@@ -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);
View
@@ -3,7 +3,8 @@
<title>debug()</title>
<script src="../debug.js"></script>
<script>
- debug.enable('*');
+ // type debug.enable('*') in
+ // the console and refresh :)
a = debug('worker:a');
b = debug('worker:b');

0 comments on commit 8ea07bc

Please sign in to comment.