Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active Sep 1, 2015
Embed
What would you like to do?
(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

This comment has been minimized.

Copy link

@bluesmoon bluesmoon commented Sep 1, 2015

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

This comment has been minimized.

Copy link
Owner Author

@cvazac 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