add.event.handler {AnalysisPageServer} | R Documentation

## add.event.handler

### Description

Add a Handler to an Event

### Usage

    add.event.handler(registry, event, handler)

### Arguments

`registry` | EventRegistry
`event` | String. Name of the Event
`handler` | Function. The new Handler to add to the Event.

### Details

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.

### Value

Nothing good.

### Author(s)

Brad Friedman

### Examples

    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)

[Package AnalysisPageServer version 1.20.0 Index]