mirror of
https://github.com/debug-js/debug.git
synced 2026-01-18 16:12:38 +00:00
Merge pull request #224 from matthewmueller/patch-1
Easier browser instructions
This commit is contained in:
commit
dc983db7d7
12
Readme.md
12
Readme.md
@ -83,19 +83,13 @@ Then, run the program to be debugged as usual.
|
||||
|
||||
## Browser support
|
||||
|
||||
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:
|
||||
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`:
|
||||
|
||||
```js
|
||||
window.myDebug = require("debug");
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
("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:
|
||||
|
||||
```js
|
||||
myDebug.enable("worker:*")
|
||||
```
|
||||
|
||||
Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console.
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user