Skip to main content
Version: 9.0.2

sb.sendEvent

sb.sendEvent(event, [channel])

Send an event to the application or to a Storyboard IO channel. channel is an optional parameter and if channel is not passed then the channel will be chosen as follows:

If the environment variable GREIONAME is set then it will be used otherwise the default channel is used.

Parameters

ParameterTypeDescription
eventstringThe event parameter is one of the following items: A string containing the event to send.
channel string(Optional) An optional Storyboard IO channel.

Event Object

KeyTypeDescription
name stringA string containing the event to send.
target stringA string containing the object to target the event to (see Storyboard IO).
format string(Optional) A string format of the event data payload.
data object(Optional) A table whose keys match up with the keys specified in the format.

A table containing the following fields: name  A string containing the event to send target  A string containing the object to target the event to (see Storyboard IO) (optional)format  A string format of the event data payload (optional)data  A table whose keys match up with the keys specified in the format (optional)channel  An optional Storyboard IO channel to send the event on, if not specified the event is added directly into the current Storyboard application event queue if neither the environment variable or global GREIONAME variable are set.

Returns: true for success, false for failure and error message string, e.g. "Can't open greio channel my_channel"

Example:

// Send to the event to the application :
var success, error = sb.sendEvent("my_event");
if(success == false) {
print(error);
//handle error
}

//To send the event to a Storyboard IO channel via parameters
var success, error = sb.sendEvent("my_event", "io_channel_name");
if(success == false) {
print(error);
//handle error
}