I want to pipe event handler of view1 to event handler of view2. As a result the following code should trigger eventListeners of both: view1 and view2:
define(function(require, exports, module) {
var Engine = require('famous/core/Engine');
var View = require('famous/core/View');
var Surface = require('famous/core/Surface');
var ctx = Engine.createContext();
var surf = new Surface({size: [150,150], properties:{background: 'red'}});
ctx.add(surf);
var view1 = new View();
var view2 = new View();
view1.subscribe(surf);
surf.on('click', function() {
view1._eventOutput.emit('A');
});
view2.subscribe(view1);
view1.on('A', function(){
console.log('A1');
})
view2.on('A', function(){
console.log('A2');
})
});
The problem is that I'm receiving only 'A1' event so view2.subscribe(view1) doesn't do the trick..
How to pipe views correctly?