Skip to content

Configurable polling timeout in watch.browser #52

@Messj1

Description

@Messj1

Hi

Nice project. Love the modular architecture. 👍

One thing i was missing was an configurable timeout. Would be nice in production mode to have bigger polling timeout than in development since it get then changed less often. 😉

So in watch.browser.js the hard coded value should be replaced by a variable, maybe a function parameter.

Then it could be implemented as a setting parameter:

var settings = grab(this, 'settings', {})
name = settings[name] && settings[name].config || name

BTW: There seems to be a bug 🐛 in the code. The interval get not stopped if someone call ulog.set("log_config", {});

set: function(name) {
if (name === 'log_config') config.update(this)

Maybe a destructor callback would do the trick. At the end, watch.browser.js would look something like that:

module.exports = function(ulog, pollingTimeout) {
  const intervalId = window.setInterval(watchFnc, pollingTimeout);
  return () => {
      window.clearInterval(intervalId);
  }
}

Metadata

Metadata

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions