Triggering Events

To trigger an event on the delegate, call the trigger() method. The first argument is the name of the event, while the second is any custom data you want to include with the element.

Let's use the file browser widget as an example. When a file is clicked, we trigger the fileselected.module_assets event. We pass to this event the internal ID of the file that was selected.

The code to achieve this is as follows:

Recite.Delegate.trigger(
    'fileselected.module_assets',
    {
        id : fileId
    }
);