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

This commit is contained in:
Tj Holowaychuk 2012-02-02 16:46:21 -08:00
parent 1335463519
commit 8ea07bc911
2 changed files with 9 additions and 1 deletions

View File

@ -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 File

@ -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');