Use topbar API to specify the delay (#2047)

This commit is contained in:
Clemens M�ller 2023-07-09 14:11:42 +02:00 committed by GitHub
parent 90ddb573af
commit bec791c66a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,17 +6,11 @@ export function registerTopbar() {
shadowColor: "rgba(0, 0, 0, .3)",
});
let topBarScheduled = null;
window.addEventListener("phx:page-loading-start", () => {
if (!topBarScheduled) {
topBarScheduled = setTimeout(() => topbar.show(), 500);
}
topbar.show(500);
});
window.addEventListener("phx:page-loading-stop", () => {
clearTimeout(topBarScheduled);
topBarScheduled = null;
topbar.hide();
});
}