1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00
pasty/web/assets/js/modules/spinner.js
Lukas Schulte Pelkum 70c4392390
Improve the frontend (API v2 functionalities) (#18)
* Fix line number height issue

* Fix notification container position

* Remove line wrapping

* Switch to the new API

* Rework JS & implement paste editing

* Implement paste reports

* Document the report webhook
2021-07-23 23:39:37 +02:00

21 lines
549 B
JavaScript

import * as Animation from "./animation.js";
const ELEMENT = document.getElementById("spinner-container");
// SHows the spinner
export function show() {
ELEMENT.classList.remove("hidden");
Animation.animate(ELEMENT, "animate__zoomIn", "0.2s");
}
// Hides the spinner
export function hide() {
Animation.animate(ELEMENT, "animate__zoomOut", "0.2s", () => ELEMENT.classList.add("hidden"));
}
// Surrounds an async action with a spinner
export async function surround(innerFunction) {
show();
await innerFunction();
hide();
}