wp_localize_script(). As the script needs to be registered before this function can be used it is normally used at the end of the controller’s
enqueue_fn() method or a method called from there.
Scripts that are automaticity enqueued are loaded after the controller’s
enqueue_fn() method. To pass variables to these scripts a separate method must be used that is hooked to the
wp_enqueue_scripts action with a priority value of 11 or greater.