%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/t/r/a/tradesc/www/relax/wp-content/plugins/wp-meteor/src/js/common/
Upload File :
Create Path :
Current File : /home/t/r/a/tradesc/www/relax/wp-content/plugins/wp-meteor/src/js/common/event-emitter.js

export default class EventEmitter {
    constructor() {
        this.l = [];
    }
    emit(name, data = null) {
        this.l[name] && this.l[name].forEach(l => l(data));
    }
    on(name, callback) {
        this.l[name] ||= [];
        this.l[name].push(callback);
    }
    off(name, callback) {
        this.l[name] = (this.l[name] || []).filter(c => c !== callback);
    }
    /*
    once(name, callback) {
        const closure = () => {
            this.off(closure);
            callback();
        }
        this.l[name] ||= [];
        this.l[name].push(closure);
    }
    */
}

Zerion Mini Shell 1.0