Merge pull request #224 from matthewmueller/patch-1

Easier browser instructions
This commit is contained in:
Nathan Rajlich 2015-09-15 18:59:06 -07:00
commit dc983db7d7

View File

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