Value

Constants::CALLBACK_TYPE_SCRIPT = 5

Semantics

Every action callback returns array( $callback_type, $payload ) from execute_callback(). With CALLBACK_TYPE_SCRIPT:

The payload is a JavaScript snippet. The dispatcher wraps it in an anonymous function ((function () { ... })();) to avoid variable-redeclaration issues, and the frontend executes it.

Typical usage

Confirmation dialogs, table refreshes, redirects (load_template), post-save behaviour.

public function execute_callback(): array {
    return array( Constants::CALLBACK_TYPE_SCRIPT, $payload );
}