Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use the web timing API if available

  • Loading branch information...
commit f3e93a14745541a8b833eda3b6e6f401326f0572 1 parent 17c5d51
Philip Tellis bluesmoon authored
Showing with 19 additions and 1 deletion.
  1. +19 −1 boomerang.js
20 boomerang.js
View
@@ -513,6 +513,8 @@ BOOMR.plugins.RT = {
return this;
}
+ // If the dev has already called endTimer, then this call will do nothing
+ // else, it will stop the page load timer
this.endTimer("t_done");
// A beacon may be fired automatically on page load or if the page dev fires
@@ -536,7 +538,23 @@ BOOMR.plugins.RT = {
}
}
else {
- BOOMR.warn("start cookie not set", "rt");
+ // TODO: Change this to info (or drop it) once the WebTiming API
+ // becomes standard (2012? 2014?)
+ BOOMR.warn("start cookie not set, trying WebTiming API", "rt");
+
+ if(w.performance && w.performance.timing) {
+ var ti = w.performance.timing;
+ // First check if requestStart is set. It will be 0 if
+ // the page were fetched from cache. If so, check fetchStart
+ // which should always be there except if not implemented. If
+ // not, then look at navigationStart. If none are set, we
+ // leave t_start alone so that timers that depend on it don't
+ // get sent back.
+ t_start = ti.requestStart
+ || ti.fetchStart
+ || ti.navigationStart
+ || undefined;
+ }
}
// make sure old variables don't stick around
Please sign in to comment.
Something went wrong with that request. Please try again.