Can I tell if my browser's network activity is working?

In the angularJS application, there is a rather long delay between the user and the server (bandwidth may also be limited), so when the user requests a new page, she has to wait about 2-500 ms to load it.

I think about “preloading” model data, templates, scripts in the background, but I intend to do this ONLY if the page is not requested by the user. If the user requests one specific page, I would like to stop the preload process and load the resources explicitly requested by the user.

So my question comes down to the following:

  • Is there a way to make an ajax request “ONLY IF” there is no network activity?
  • Is there a way to “pause” the current start of ajax requests? or
  • Is there any way to prioritize ajax requests?

Thanks,

+2
source share
1 answer

Requestidlecallback seems to be what you are looking for. There is also a built-in package that provides an event that you can listen to: https://github.com/choojs/on-idle

-one
source

All Articles