Created
August 15, 2013 13:05
-
-
Save frostney/6240668 to your computer and use it in GitHub Desktop.
Basic shim for getting performance.now() when now function is prefixed. (Prefixes everywhere :) )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var performance = window.performance; | |
performance.now = performance.now || (function() { | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
var functionName = ''; | |
for (var i = 0, j = vendors.length; i < j; i++) { | |
functionName = vendors[i] + 'Now'; | |
if (performance[functionName]) { | |
return performance[functionName]; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment