Skip to content

Commit 62ae63b

Browse files
author
dnolen
committed
check that performance.now method actually exists
1 parent b12d836 commit 62ae63b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,14 @@
337337
"Returns highest resolution time offered by host in milliseconds."
338338
[]
339339
(cond
340-
(exists? js/performance) (.now js/performance)
341-
(exists? js/process) (let [t (.hrtime js/process)]
342-
(/ (+ (* (aget t 0) 1e9) (aget t 1)) 1e6))
340+
(and (exists? js/performance)
341+
(not (nil? (. js/performance -now))))
342+
(.now js/performance)
343+
344+
(exists? js/process)
345+
(let [t (.hrtime js/process)]
346+
(/ (+ (* (aget t 0) 1e9) (aget t 1)) 1e6))
347+
343348
:else (.getTime (js/Date.))))
344349

345350
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; arrays ;;;;;;;;;;;;;;;;

0 commit comments

Comments
 (0)