Skip to content

Instantly share code, notes, and snippets.

@andrewvmail
Created October 18, 2018 21:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewvmail/ffcaf95846a2f3b7ae96800d00c3ee6b to your computer and use it in GitHub Desktop.
Save andrewvmail/ffcaf95846a2f3b7ae96800d00c3ee6b to your computer and use it in GitHub Desktop.
performance snippets
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