Sha256: 4c5e6e6cd67227625cf9c97d22684aed6c4107bfbbc84373a13f17829a66b924
Contents?: true
Size: 752 Bytes
Versions: 31
Compression:
Stored size: 752 Bytes
Contents
import { createHtmlElement } from "alchemy_admin/utils/dom_helpers" export default class Spinner { constructor(size, color = "currentColor") { this.size = size this.color = color this.spinner = undefined } /** * @returns {HTMLElement|undefined} */ get el() { return this.spinner } /** * @param {HTMLElement|undefined} parent */ spin(parent) { if (typeof parent === "undefined") { parent = document.body } this.spinner = createHtmlElement( `<alchemy-spinner size="${this.size}" color="${this.color}"></alchemy-spinner>` ) parent.append(this.spinner) return this } stop() { if (this.spinner) { this.spinner.remove() this.spinner = undefined } } }
Version data entries
31 entries across 31 versions & 1 rubygems