Invoke custom JS function in AJAX callback? Is it possible to invoke a custom JS function in an AJAX callback?

function MY_MODULE_ajax_callback() {
  // Define a new array to hold our AJAX commands.
  $ajax_commands = array();

  // Create a new AJAX command that replaces the #page text with our own text.
  $ajax_commands[] = [CUSTOM JS FUNCTION]

  // Return our commandS
  return array('#type' =&gt; 'ajax','#commands' =&gt; $commands);
}
Yes, it is.

Code sample:

$commands = array();
$commands[] = array(
    'command' =&gt; 'your_js_callback', // the name of your javascript callback
    'value1'  =&gt; 'My first value',
    'value2'  =&gt; 'My second value',
);


JS Code:

(function($, Drupal) {
    Drupal.ajax.prototype.commands.your_js_callback = function(ajax, response, status) {
        alert(response.value1);
        alert(response.value2);
    }
})(jQuery, Drupal);