Module: 'brixy.ui.components.safeHandlers'

Defines components for module:'brixy.ui.SuiBuilder'~SuiBuilder.
Creates event handlers for Script UI controls. Wraps a callback to try/catch block so it can report error if any.
Script UI controls don't show errors, that are thrown from the event handlers, while window is opened.

Example:
function myHandler() {
	// do something bad
	throw 'This is bad.';
}

// standard handler: after click does nothing
builder.button.set('onClick', myHandler);

// safe handler: after click shows error report
builder.button.safeHandler('onClick', myHandler);
Source:

Methods

(static) safeHandler (eventName, callback)

Adds event handler to the current element. Reports error if any occurs.

Parameters:
Name Type Attributes Description
eventName string

Event names: 'onClick', 'onChange', ...

callback function

Event handler.

pars, ... * <optional>
<repeatable>

Additional parameters will be passed to callback method. (optional)

Source:

(static) safeRequestHandler (eventName, appId, request)

Adds event handler that calls BX.apps.processRequest() method. Reports error if any occurs.

Parameters:
Name Type Description
eventName string

Event names: 'onClick', 'onChange', ...

appId string

Application ID.

request string | Object

Request route.

Source:

(static) safeRequestOnClick (appId, request)

Adds 'onClick' handler that calls BX.apps.processRequest() method. Reports error if any occurs.

Parameters:
Name Type Description
appId string

Application ID.

request string | Object

Request route.

Source: