Learn R Programming

AnalysisPageServer (version 1.6.2)

trigger.event: trigger.event

Description

Trigger a registered Event

Usage

trigger.event(registry, event, ...)

Arguments

registry
EventRegistry
event
Name of event to trigger
...
Further parameters are passed to each handler in turn.

Value

See Details

Details

Trigger a registered Event.

Every handler is called in turn. If any handler returns a value with a "CatchEvent" attribute set to TRUE then no further handlers are called. That attribute is removed from the return value and the value is returned to the triggering context. Otherwise the return value of only the last function is called.

If no handlers are registered then NULL is returned.

If no Event exists of that name then an error is thrown.

Examples

Run this code
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)

Run the code above in your browser using DataLab