mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
24 lines
475 B
JavaScript
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; |