An trigger can execute an action on the server-side which can return some data asynchronous. Triggers are the only one way for obtaining some code-lists from server-side.
// Register a trigger
FLOW.trigger('name', function(next, data) {
// Data sent from client-side
console.log(data);
// Sends back some data
next([1, 2, 3, 4]);
});
// Unregister a trigger
FLOW.trigger('name', null);
Trigger can be used in the Settings form of specific component.
// TRIGGER(trigger_name, [data], callback(data))
// Call the trigger
TRIGGER('name', function(data) {
console.log(data); // outputs [1, 2, 3, 4]
});
TRIGGER('name', 'path.to.bind.response');
// Binds the response to: window.path.to.bind.response === [1, 2, 3, 4]
Learn from some components which use trigger functionality: