(label, icon, onClick, disabled = false, isRight = false)
| 2642 | |
| 2643 | class Button { |
| 2644 | constructor(label, icon, onClick, disabled = false, isRight = false) { |
| 2645 | this.element = document.createElement("div"); |
| 2646 | this.button = document.createElement("button"); |
| 2647 | this.icon = icon; |
| 2648 | this.onClick = onClick; |
| 2649 | this.disabled = disabled; |
| 2650 | this.tippy = Spicetify.Tippy?.(this.element, { |
| 2651 | content: label, |
| 2652 | ...Spicetify.TippyProps, |
| 2653 | }); |
| 2654 | this.label = label; |
| 2655 | |
| 2656 | this.element.appendChild(this.button); |
| 2657 | if (isRight) { |
| 2658 | this.button.className = rightGeneratedClassName; |
| 2659 | rightButtonsStash.add(this.element); |
| 2660 | rightContainer?.prepend(this.element); |
| 2661 | } else { |
| 2662 | this.button.className = leftGeneratedClassName; |
| 2663 | leftButtonsStash.add(this.element); |
| 2664 | leftContainer?.append(this.element); |
| 2665 | } |
| 2666 | } |
| 2667 | get label() { |
| 2668 | return this._label; |
| 2669 | } |
nothing calls this directly
no test coverage detected