Overriding bind and unbind
The following diagrams outline when the
and
methods are called. Firstly let’s take a look at how binding works.
The
function is very similar. Upon detaching the widget from the DOM the
method is called to enable us to perform tasks such as adding and removing listeners to avoid memory leaks. The diagram below demonstrates this.
Now that we have had a brief introduction of
and
let’s see the methods put into action when we bind appropriate listeners for events.