Micromodal icon indicating copy to clipboard operation
Micromodal copied to clipboard

Is there any way to pass custom parameter on MicroModal.show ?

Open SirMishaa opened this issue 4 years ago • 0 comments

Hello !

I would like to pass some custom parameters when I open a Modal.

/**
 * Kick player from team with id
 * @param {MouseEvent} event
 */
function kickPlayer(event) {
    const id = event instanceof MouseEvent ? +event.target.dataset.id : null
    if (id) {
        MicroModal.show('modal-kickPlayer', {
            "custom-parameter": id
        })
    }
}

const kickButtons = document.querySelectorAll('button.custom_kickPlayer');
if (kickButtons) {
    Array.from(kickButtons).forEach(item => {
        item.addEventListener('click', kickPlayer);
    })
}

Is it possible ? Thank you very much. I hope the question hasn't already been asked.

SirMishaa avatar Jul 04 '20 11:07 SirMishaa