Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better Browser Support without refresh the page #534

Closed
mydearxym opened this issue Dec 13, 2017 · 5 comments
Closed

better Browser Support without refresh the page #534

mydearxym opened this issue Dec 13, 2017 · 5 comments
Labels
awaiting-response This issue or pull request is awaiting a user's response question This issue asks a question or requests usage support

Comments

@mydearxym
Copy link

hi there ~

in the doc:

Debug's enable state is 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:
localStorage.debug = 'worker:*'
And then refresh the page.

is there a way to not refresh the page and make it work ?

@czaarek99
Copy link

czaarek99 commented Apr 15, 2018

The reason for this seems to be because it's just coded that way. You can see here that the load() method that reads the local storage only gets called when the debug object is created. We could listen for the storage event to know when to update the state.

@czaarek99
Copy link

It seems like implementing this would lead to huge breaking changes with the current way debug is coded. To be able to change the namespaces for debug instances live you'd need to somehow expose this method to browser.js.

What you could do is listen to the storage event yourself and just recreate your debug instances this way they would re-read the localStorage.

@leahciMic
Copy link

leahciMic commented May 10, 2018

@mydearxym the debug module exposes an enable method. So you could dynamically enable/ disable things by doing:

localStorage.debug = '';

const debug = require('debug');
const log = debug('MyApplication:log');

log('blah');  // not logged

debug.enable('*');

log('blah'); // logged

@Qix- Qix- added the question This issue asks a question or requests usage support label Jun 20, 2018
@Qix-
Copy link
Member

Qix- commented Jun 20, 2018

@mydearxym Did @leahciMic and @czaarek99 answer your question?

@Qix- Qix- added the awaiting-response This issue or pull request is awaiting a user's response label Jun 20, 2018
@mydearxym
Copy link
Author

@Qix- @leahciMic @czaarek99 sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-response This issue or pull request is awaiting a user's response question This issue asks a question or requests usage support
Development

No branches or pull requests

4 participants