bind

Attaches a handler to an event.

Parameters

eventName String

The name of the event.

handler Function

A function to execute each time the event is triggered. That function should have a single parameter which will contain any event specific data.

Important: The context (this) of the handler function is set to the observable object itself.

Example - subscribing to an event

<script>
var obj = new kendo.Observable();
obj.bind("myevent", function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(e.sender === obj); // outputs "true"
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(this === obj); // also outputs "true"
});
obj.trigger("myevent"); // causes the handler to be executed
</script>
In this article