performance-now.js (1061B)
1 // Generated by CoffeeScript 1.12.2 2 (function() { 3 var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; 4 5 if ((typeof performance !== "undefined" && performance !== null) && performance.now) { 6 module.exports = function() { 7 return performance.now(); 8 }; 9 } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) { 10 module.exports = function() { 11 return (getNanoSeconds() - nodeLoadTime) / 1e6; 12 }; 13 hrtime = process.hrtime; 14 getNanoSeconds = function() { 15 var hr; 16 hr = hrtime(); 17 return hr[0] * 1e9 + hr[1]; 18 }; 19 moduleLoadTime = getNanoSeconds(); 20 upTime = process.uptime() * 1e9; 21 nodeLoadTime = moduleLoadTime - upTime; 22 } else if (Date.now) { 23 module.exports = function() { 24 return Date.now() - loadTime; 25 }; 26 loadTime = Date.now(); 27 } else { 28 module.exports = function() { 29 return new Date().getTime() - loadTime; 30 }; 31 loadTime = new Date().getTime(); 32 } 33 34 }).call(this); 35 36 //# sourceMappingURL=performance-now.js.map