You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * Returns the browser's first paint metric (if available). * @return {number} The first paint time in ms. */functiongetFirstPaintIfSupported(){/* ... */}// Take measurement after page load.window.addEventListener('load',function(){constfp=getFirstPaintIfSupported();if(fp){constmetric=newMetric('firstpaint');//If I call log heremetric.log();// I get firstpaint -1 ms// No need to call start()/end(). Can send a value, directly.metric.sendToAnalytics('load',metric.name,fp);}});
Of course I can manually generate the log, but it could be nice if the log could take an overridable duration parameter (like sendToAnalytics):
Not sure I follow completely. .log() is just meant as a convenient helper for writing the console.log statement yourself. It should really throw if start and end were never called. If you want to log a custom metric, maybe just console.log what you want :) ?
Yeah, of course I can write the log statement myself. I just thought it would be nicer if I could use metric.log to remain consistent. Rather than switching between metric.log and console.log, if I want to keep my log messages the same it means that I must know the internals of how metric is doing it's logging (and format my console.log the same).
Maybe metric.log really should throw an error if there is no duration associated to it?
In the first paint example
Of course I can manually generate the log, but it could be nice if the log could take an overridable duration parameter (like sendToAnalytics):
Or maybe a way to set the duration itself for these types of events?
What do you think?
The text was updated successfully, but these errors were encountered: