| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- export class loading_screen {
- static #instance;
-
- #screen;
- constructor(classname = "loading-screen") {
- if (!loading_screen.#instance) {
- loading_screen.#instance = this;
- this.#init(classname);
- }
- return loading_screen.#instance;
- }
- get time() {
- return 1000;
- }
- #init(classname) {
- this.#screen = document.querySelector(`.${classname}`);
- this.#screen.style.transitionDuration = `${this.time / 1000}s`;
- this.show();
- }
- get visible() {
- return !this.#screen.classList.contains("hidden");
- }
- show() {
- if (!this.visible) {
- this.#screen.classList.remove("hidden");
- }
- }
- hide() {
- if (this.visible) {
- this.#screen.classList.add("hidden");
- }
- }
- }
|