test: 🧪 MutationObserver

This commit is contained in:
ThatOneCalculator 2022-03-22 13:16:59 -07:00
parent db834b108f
commit 6ec8b47cfb
1 changed files with 6 additions and 2 deletions

View File

@ -75,7 +75,9 @@ tippy("#github-button", {
allowHTML: true,
})
window.addEventListener("popstate", () => {
let observer = new MutationObserver(callback)
function callback() {
let theme = ""
if (window.location.pathname == "/") {
@ -92,4 +94,6 @@ window.addEventListener("popstate", () => {
//@ts-ignore
i._tippy.setProps({ theme: theme })
}
})
}
observer.observe(document.getElementById("code-view-pre"))