2016-11-02 16:12:13 -06:00

24 lines
475 B
JavaScript

var pubsub = require('~/util/pubsub');
function Widget(config) {
this.name = config.name;
var self = this;
if (config.channel) {
pubsub.channel(config.channel).on('emitTestEvent2', function() {
self.emitTestEvent2();
});
}
}
Widget.prototype = {
emitTestEvent1: function() {
this.emit('testEvent', 'a', 'b');
},
emitTestEvent2: function() {
this.emit('testEvent');
}
};
exports.Widget = Widget;