A Function that is set as a property within a Component. And is usually called when some event occurs on the Component.
If you wish to display a dialog which reads "I was clicked" when the user clicks on the Component componentB, you would write a method stored as a variable which does this:
var mouseDownCallbackFunction = function() {
alert("I was clicked!");
};
Next, you would set this function inside the component like so...
// Set the Component to display the dialog when the
// user presses the mouse down on it.
componentB.setMouseDownCallback(mouseDownCallbackFunction);
And this would cause mouseDownCallbackFunction to display "I was clicked" in an alert box when the component was clicked.
Yes, this is describing the exact definition of a callback...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With