From a142c3997c7ed1734778873720cb6331247c35b3 Mon Sep 17 00:00:00 2001 From: Matthew Mueller Date: Tue, 15 Sep 2015 17:02:39 -0700 Subject: [PATCH] Easier browser instructions Learned this trick from @rauchg. much easier and doesn't require a globally exposed debug. --- Readme.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Readme.md b/Readme.md index b4f45e3c..cd9d61b9 100644 --- a/Readme.md +++ b/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');