Dynamically load animations.

This makes sure that we don't have to serve the open animation when the bar is actually closed.
This commit is contained in:
2019-03-13 13:25:57 +01:00
parent ca6eb29ff8
commit dc73d12c26

View File

@@ -1,12 +1,14 @@
import "./style.scss";
import {startClosedAnimation} from "./closed";
import {startOpenAnimation} from "./open";
window.addEventListener('load', function () {
if (document.body.classList.contains('open')) {
startOpenAnimation();
import("./open").then(function (module) {
module.startOpenAnimation();
});
} else {
startClosedAnimation();
import("./closed").then(function (module) {
module.startClosedAnimation();
});
}
doIfAuthorized(showToggleButton);