mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-11 05:56:26 +08:00
Add delayed top bar (#973)
This commit is contained in:
parent
0f4ef593bc
commit
aafa5cc642
1 changed files with 14 additions and 2 deletions
|
@ -69,8 +69,20 @@ topbar.config({
|
||||||
barColors: { 0: "#b2c1ff" },
|
barColors: { 0: "#b2c1ff" },
|
||||||
shadowColor: "rgba(0, 0, 0, .3)",
|
shadowColor: "rgba(0, 0, 0, .3)",
|
||||||
});
|
});
|
||||||
window.addEventListener("phx:page-loading-start", () => topbar.show());
|
|
||||||
window.addEventListener("phx:page-loading-stop", () => topbar.hide());
|
let topBarScheduled = null;
|
||||||
|
|
||||||
|
window.addEventListener("phx:page-loading-start", () => {
|
||||||
|
if (!topBarScheduled) {
|
||||||
|
topBarScheduled = setTimeout(() => topbar.show(), 200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("phx:page-loading-stop", () => {
|
||||||
|
clearTimeout(topBarScheduled);
|
||||||
|
topBarScheduled = null;
|
||||||
|
topbar.hide();
|
||||||
|
});
|
||||||
|
|
||||||
// connect if there are any LiveViews on the page
|
// connect if there are any LiveViews on the page
|
||||||
liveSocket.connect();
|
liveSocket.connect();
|
||||||
|
|
Loading…
Add table
Reference in a new issue