Created
October 18, 2018 21:20
-
-
Save andrewvmail/ffcaf95846a2f3b7ae96800d00c3ee6b to your computer and use it in GitHub Desktop.
performance snippets
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
let toggle = false | |
const attachHandler = () => | |
document | |
.getElementById("message-composer-input") | |
.addEventListener("change", function() { | |
if(!toggle) { | |
performance.mark('start') | |
} else { | |
performance.mark('end') | |
performance.measure( | |
"test", | |
"start", | |
"end" | |
); | |
var measures = performance.getEntriesByName("start"); | |
var measure = measures[0]; | |
console.log("setTimeout milliseconds:", measure.duration) | |
performance.clearMarks(); | |
performance.clearMeasures(); | |
} | |
toggle = !toggle | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment