Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active September 1, 2015 17:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cvazac/fdcbb561e1e77f742897 to your computer and use it in GitHub Desktop.
(function(w) {
if (!w || !("performance" in w) || !w.performance || !performance.getEntriesByName) {
return;
}
BOOMR = w.BOOMR || {};
BOOMR.plugins = BOOMR.plugins || {};
BOOMR.plugins.WaitForMark = {
markFound: false,
init: function() {
var markName = "cav";
function poll() {
var entries = performance.getEntriesByName(markName);
if (entries.length == 0) {
return setTimeout(poll, 500);
}
BOOMR.plugins.WaitForMark.done();
BOOMR.sendBeacon();
}
poll();
},
done: function() {
this.markFound = true;
},
is_complete: function() {
return this.markFound === true;
}
};
})(window);
@bluesmoon
Copy link

Question: do they want to set page load time to when the mark fires, or is page load time still tied to onload and the mark is just measured as a custom timer? If the former, then you will have to update t_done to be the mark's time.

@cvazac
Copy link
Author

cvazac commented Sep 1, 2015

I went the custom timer route

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment