Events
There are on and un methods for responding to server commands or interacting with a page widget. Via these methods, subscribing and unsubscribing from widget events is performed.
An example of interaction with events:
var onRender = function () {
sitephone.show();
};
//subscribe to an event
sitephone.on('render', onRender);
//Unsubscribe from an event
sitephone.un('render', onRender);
Cancelling method calls via events before{methodName}
There are events that precede a method calls:
- beforeshow
- beforehide
- beforedestroy
- beforerender
If you return these events in an explicit form false
in a processor, methods of the same will not be called
Example:
sitephone.on('beforeshow', function () {
return !customWidget.isVisible();
});
sitephone.show();
In this example, the show method will not be called if the processor returns false
.