mirror of
https://github.com/debug-js/debug.git
synced 2026-01-18 16:12:38 +00:00
Fixed: persist client-side variant again. Closes #9
This commit is contained in:
parent
1335463519
commit
8ea07bc911
7
debug.js
7
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);
|
||||
@ -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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user