Description
This method lets us define events on template elements and bind them to methods in a view. If we have no events to define in the view, we don’t need to override this method.
Called by the render() method of a view.
function getEvents() {
return {
'submit form': 'saveForm',
'click [data-action="include_email"]': 'includeAnotherEmail',
'keypress [data-action="text"]': 'preventEnter',
'blur [name="title"]': 'onFormFieldChange',
'blur [name="category"]': 'onFormFieldChange',
'blur [name="message"]': 'onFormFieldChange',
'blur [name="email"]': 'onFormFieldChange'
};
}
Returns : The returned object can contain any number of key/value pairs, where the key is the event and a selector, and the value is the method to call. Define key/value pairs in the format {event selector: method}.