holidayextras / barometer

Framework agnostic browser performance metrics
MIT License
5 stars 5 forks source link

Expose pageChange idle detection to application code #16

Closed djbeaumont closed 7 years ago

djbeaumont commented 7 years ago

It would be very useful for application code to implement loading of assets or start small pieces of computationally intensive work without blocking the critical rendering path. For example:

window.barometer.onPageIdle(function() {
  loadGoogleMapsApi();
  performLargeButNotCriticalAjaxRequest();
});
msaspence commented 7 years ago

This is a nice idea but it seems like it is outside the scope of barometer? Should this not have its own library and be part of it own library?

theninj4 commented 7 years ago

In the perfect world we could break this project down into lots of micro-modules, ultimately we'd like this functionality available to us in production very soon - we've got a good implementation in a small module that we're prepared to load before everything else, we should simply use it.

theninj4 commented 7 years ago

This is being renamed to onPageChanged and we're adding another callback for oncePageLoaded which will only trigger once.