feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Runtime stops executing when in background

Open tomlarkworthy opened this issue 2 years ago • 7 comments

Describe the bug This is a fairly old behaviour but I was unsure if it was normal JS or not, now I am sure it isn't

When you switch tabs, the runtime stops propagating changes. This can cause problems for long running process, networked applications etc. In my case it messes up livecoding (https://observablehq.com/@endpointservices/livecode).

I think this behavior was introduced with https://observablehq.com/@observablehq/visibility ? Anyway, I want a way to switch it off, IMHO, its an overreach into userspace and diminishes the usefulness of the environment, you can't make anything that works in the background (e.g. a chat application)

To Reproduce visit https://observablehq.com/d/6f1bffd7be0752e5 and switch tabs, note the change in the console log.

Expected behavior I would expect normal Javascript behaviour that everything keeps running when switching tabs.

Desktop (please complete the following information):

  • OS: Mac
  • Browser Chrome
  • Version 102

tomlarkworthy avatar Jun 28 '22 11:06 tomlarkworthy