/**
 *
 *
 *  @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))
        }
    }

}