Skip to content

Commit a142c39

Browse files
Easier browser instructions
Learned this trick from @rauchg. much easier and doesn't require a globally exposed debug.
1 parent fefdae5 commit a142c39

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

Readme.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,13 @@ Then, run the program to be debugged as usual.
8383

8484
## Browser support
8585

86-
Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include:
86+
Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. You can enable this using `localStorage.debug`:
8787

8888
```js
89-
window.myDebug = require("debug");
89+
localStorage.debug = 'worker:*'
9090
```
9191

92-
("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console:
93-
94-
```js
95-
myDebug.enable("worker:*")
96-
```
97-
98-
Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console.
92+
And then refresh the page.
9993

10094
```js
10195
a = debug('worker:a');

0 commit comments

Comments
 (0)