CoreFiles by mySites.guru
Event.js32 lines, 544 bytes, from Joomla_4.0.0-alpha9-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha8
md5
d6b5540a7950afe85f908cb82d2639fa
sha1
dfb2dba36e830a382ff71e27430c447b3768bbdc
sha256
2c3aec9767e0086c8dd9b4e9d99e61a36f0cd6150b598d5ff88e39e1f1b22fb9
import Vue from "vue";

/**
 * Media Event bus - used for communication between joomla and vue
 */
export default class Event {

    /**
     * Media Event constructor
     */
    constructor() {
        this.vue = new Vue();
    }

    /**
     * Fire an event
     * @param event
     * @param data
     */
    fire(event, data = null) {
        this.vue.$emit(event, data);
    }

    /**
     * Listen to events
     * @param event
     * @param callback
     */
    listen(event, callback) {
        this.vue.$on(event, callback);
    }
}

The same content is in 10 releases, Joomla 4.0.0-alpha2 to 4.0.0-alpha12. See them all, or every version of this file.