Skip to content

Commit

Permalink
Easier browser instructions
Browse files Browse the repository at this point in the history
Learned this trick from @rauchg. much easier and doesn't require a globally exposed debug.
  • Loading branch information
matthewmueller committed Sep 16, 2015
1 parent fefdae5 commit a142c39
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit a142c39

Please sign in to comment.