You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
modal/src/tiny-modal-mixin.js

45 lines
650 B

/**
*
*
* @author Björn Hase
*
*/
export default {
/**
*
*
* @param {string} id
*
*/
openModal(id) {
this.__dispatchModal(id, 'open')
},
/**
*
*
* @param {string} id
*
*/
closeModal(id) {
this.__dispatchModal(id, 'close')
},
/**
*
*
* @param {[type]} id [description]
* @param {[type]} type [description]
*
*/
__dispatchModal(id, type) {
const destination = document.getElementById(id)
if (destination) {
destination.dispatchEvent(new CustomEvent(type))
}
}
}