Ipywidgets background updates when the browser window is not shown, makes the browser run out of resources

I use Jupyter to show real time sensor data via ipywigdets and BQplot from various sources. The data is updated in the background using threads - that all works fine as long as the browser window is being displayed. But in case the browser window is not shown, re-draw events are queued up causing the browser to eventually stall / crash with out-of-memory exceptions. My current workaround is a hook into via JS using

document.addEventListener(‘visibilitychange’, onVisibilityChanged);

call back and then setting a global Python variable.
But there must be a more elegant way for that?!?!

Any advice really appreciated.