Custom events

Previous Next

In addition to the USoft predefined events, you can create custom events.

You must set, trigger and remove custom events yourself, using the appropriate .on(), .off() and .trigger() functions. Options can be passed to custom events by using the options parameter in the same way as with predefined events.

In the following examples, a custom event called "myevent" is used.

Example 1

$("#input").on("myevent", function(evt, options) {

  alert("This is a custom event on a UI element"); 

});

 

$("#input").trigger("myevent");

$("#input").off("myevent");

 

Example 2

$.udb.on("myevent", function(evt, options) {

  alert("This is a custom event on the $.udb object"); 

});

 

$.udb.trigger("myevent");

$.udb.off("myevent");

 

Example 3

$.udb("EMP").on("myevent", function(evt, options) {

  alert("This is a custom event on the EMP data source"); 

});

 

$.udb("EMP").trigger("myevent");

$.udb("EMP").off("myevent");

 

 

See Also

Top-level Events

Data Source Events

Control Events