According to documentation:
https://webix.gitbook.io/webix-jet/part-ii-webix-jet-in-details/view-communication#attaching-an-event-listener
there is a suggestion to attach the event listener in the component as follows ( bad pattern)
// views/form.js
import {JetView} from "webix-jet";
export default class FormView extends JetView{
init(){
this.app.attachEvent("save:form", function(){
this.show("aftersave");
});
}
}
Never use “app.attachEvent” in the lifecycle event component unless you want to manually detach events
Here’s why:
https://snippet.webix.com/e46olhjn
see console after app.refresh() => script error
If you use plugins which they use app.refresh() (i.e. Locale, Theme) or call it manually, subsequent event handling will be additive.
Do this instead:
// views/form.js
import {JetView} from "webix-jet";
export default class FormView extends JetView{
init(){
this.on(this.app, "save:form", function(){
this.show("aftersave");
});
}
}
It would be nice to correct this in the documentation.