Last active
February 17, 2020 21:10
-
-
Save vigneshshanmugam/2bdcba10d0338eca1ef2ee3dd0869d4f to your computer and use it in GitHub Desktop.
Observing longtasks using performance observer
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
const observer = new PerformanceObserver(function(list) { | |
const entries = list.getEntries(); | |
// An example entry looks something like this | |
const exampleEntry = { | |
name: "same-origin-descendant", | |
entryType: "longtask", | |
startTime: 1023.40999995591, | |
duration: 187.19000002602115, | |
attribution: [ | |
{ | |
name: "unknown", | |
entryType: "taskattribution", | |
startTime: 0, | |
duration: 0, | |
containerType: "iframe", | |
containerSrc: "child.html", | |
containerId: "", | |
containerName: "child1" | |
} | |
] | |
}; | |
}); | |
observer.observe({ type: "longtask", buffered: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment