Hello,
I’m using V1 framework (1.20)
How can I set up communication between different views ?
I see there are subjects about eventBus vue, but can’t see how to use this in Framework7 V1
Which framework you use underlyling ? vue, react ?
eventBus is not framework 7 spesific, you can use eventBus vue if only if you use vue, meanwhile if you also use vuex, then you dont need a seperate event bus, you can just use the state.
There is no something like event bus in v1, but you can just use custom DOM events:
$(document).on('custom-event', function (e) {
// do something
var data = e.detail;
console.log(data.foo); // -> 'bar'
});
// and somewhere else to trigger event with data object in second argument
$(document).trigger('custom-event', { foo: 'bar' });
Ah ok. I’ll use trigger as you suggested, thanks.