mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
26 lines
556 B
JavaScript
26 lines
556 B
JavaScript
var pubsub = require('~/util/pubsub');
|
|
|
|
module.exports = {
|
|
onInput: function(input) {
|
|
this.name = input.name;
|
|
this.channel = input.channel;
|
|
},
|
|
|
|
onMount: function() {
|
|
var self = this;
|
|
|
|
if (this.channel) {
|
|
pubsub.channel(this.channel).on('emitTestEvent2', function() {
|
|
self.emitTestEvent2();
|
|
});
|
|
}
|
|
},
|
|
|
|
emitTestEvent1: function() {
|
|
this.emit('testEvent', 'a', 'b');
|
|
},
|
|
|
|
emitTestEvent2: function() {
|
|
this.emit('testEvent');
|
|
}
|
|
}; |