Description Usage Arguments Details Value Author(s) Examples
View source: R/event.registry.R
Add a Handler to an Event
1 | add.event.handler(registry, event, handler)
|
registry |
EventRegistry |
event |
String. Name of the Event |
handler |
Function. The new Handler to add to the Event. |
A Handler is any function to be called when the event is triggered. If the return value of the Handler has a "CatchEvent" attribute which is TRUE then the event will be caught and not bubble to the next handler, and the "CatchEvent" attribute will be stripped before returning the value to the triggering context.
If the Event does not yet exist an error is thrown.
Nothing good.
Brad Friedman
1 2 3 4 | r <- new.event.registry()
add.event(r, "mouseclick")
add.event.handler(r, "mouseclick", function(x, y) message("Mouse clicked at coordinates (", x, ", ", y, ")"))
trigger.event(r, "mouseclick", x = 30, y = 50)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.