How do you know when your app is idle?

Does Aurelia offer any support for detecting when your app is idle?

Can you describe what exactly means idle? Like the user isnt using the mouse or keyboard?

That’s a fair question.

An idle user might not be typing or clicking, an idle data-channel would be passing no bytes, and an idle UI might not be passing any Events. And speaking of events - the event loop might not be doing much.

I could setInterval an idleFlag and clear it using mouse and keyboard events, and when data flowed, and when the route changed, and when dialogs were open/closed, and, and, and…

It’s sort of a ‘I wonder…’ question before started trying to figure out what idle really meant and all the different things I would have to hook into.

For Instance: I don’t want to have to subscribe to dozens of EventAggregator messages, I wonder if there is a way to spy on the traffic/rate

I guess it would be different between apps… Unless it was simply mouse/keyboard…

just override the default xmlhttprequest with your own version or override its send method with your own version calling the original method after storing it.

1 Like

This might be of help

1 Like

Another thing that might help would be taskQueue.flushing (this is a private property I believe). This indicates whether there are any microTasks currently being processed. If this property is false, it means there are no pending changes on the queue from bindings / observers / behaviors.