The following diagrams outline when the

zk.Widget

and

zk.Widget

methods are called. Firstly let’s take a look at how binding works.

The

zk.Widget

function is very similar. Upon detaching the widget from the DOM the

zk.Widget

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

zk.Widget

and

zk.Widget

let’s see the methods put into action when we bind appropriate listeners for events.