Skip to content

Instantly share code, notes, and snippets.

@brendandahl
Created May 23, 2019 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendandahl/c8f54e9edbac0388323bbd9cbf576227 to your computer and use it in GitHub Desktop.
Save brendandahl/c8f54e9edbac0388323bbd9cbf576227 to your computer and use it in GitHub Desktop.
Log the load events of a document.
const domContentLoadedPromise = new Promise(resolve => {
window.addEventListener("DOMContentLoaded", () => {
dump(">>> dialog - DOMContentLoaded event" + window.document.documentURI + "\n");
resolve();
}, { capture: true, once: true });
});
domContentLoadedPromise.then(() => {
dump(">>> dialog - Promise for domContentLoadedPromise resolved\n");
});
window.addEventListener("load", () => {
dump(">>> dialog - load event\n")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment