Skip to content

Commit

Permalink
Fixed: persist client-side variant again. Closes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Feb 3, 2012
1 parent 1335463 commit 8ea07bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions debug.js
Expand Up @@ -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.
Expand All @@ -49,6 +50,8 @@ debug.names = [];
*/

debug.enable = function(name) {
localStorage.debug = name;

var split = (name || '').split(/[\s,]+/)
, len = split.length;

Expand All @@ -74,3 +77,7 @@ debug.enabled = function(name) {
}
return false;
};

// persist

if (window.localStorage) debug.enable(localStorage.debug);
3 changes: 2 additions & 1 deletion example/browser.html
Expand Up @@ -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');
Expand Down

0 comments on commit 8ea07bc

Please sign in to comment.