addyosmani / timing.js

Navigation Timing API measurement helpers
1.5k stars 114 forks source link

Prevents breaking where getTimes returns undefined #10

Closed cphoover closed 9 years ago

cphoover commented 9 years ago

In browsers that do not support the navigation timings api (e.g safari) this inclusion of this library will cause the throwing of the following error:

"TypeError: Requested keys of a value that is not an object."

This is because timing.getTimes returns undefined. When Object.keys is passed an undefined value it throws.

This change allows inclusion of this library without throwing.