s = CS.execute(action := ...ʃ, arguments := ...ʅ)
Argument | Description | Types / Required |
action | The name of the action to execute. | string
required |
arguments | Arguments for the action. | object
not required |
The
execute action executes another action with the action name specified as a string argument
action. Action names are specified without the prefix
"CS.", e.g.,
"Clipboard.getText" for
Clipboard.getText. If the action to be called requires arguments, they can be forwarded to the action using
arguments.
Although
execute can be used to execute any action, generally you will want to call the action directly. However,
execute provides a generalized framework for executing actions by calling a single action as an entry point. A related action,
Localhost.mapActionResult, executes an action and maps the result as a
localhost URL.
The action returns the result of the other action executed.
The action throws an exception if any of its arguments are not specified in a valid form, if the action name is not valid, or if the other action executed throws an exception.
// calling an action directly
let birdHash = CS.Hash.createHash({
text: "Eurasian Hoopoe",
salt: "Bucerotiformes",
saltFormat: "text"
});
// calling an action indirectly
birdHash = CS.execute({
action: "Hash.createHash",
arguments: {
text: "Eurasian Hoopoe",
salt: "Bucerotiformes",
saltFormat: "text"
}
});