1 import { v4 as uuid } from 'uuid';
2 import $ from 'jquery';
3 import { CustomEventManager } from './events';
5 export class Modal extends CustomEventManager {
9 this.id = `id-${uuid()}`;
12 setBody(text: string) {
13 this.$el().find('.modal-body').html(text);
16 render(visible: boolean = false) {
18 <dialog id="${this.id}">
19 <div class="modal-header"><span class="close-modal">x</span></div>
20 <div class="modal-body">Modal Body!</div>
24 if(this.$el().length) {
28 $('body').append(html);
29 this.emit('ready', [this]);
34 return $(`#${this.id}`);
39 this.$el().get(0)?.showModal();