REST API Core Settings (wpApiSettings) - markhowellsmead/helpers GitHub Wiki
WordPress core contains an backbone API client which can be used in our JavaScript files to get e.g. the root URL or the current nonce
value, or to carry otu more complex actions. In order to use it, add wp-api as a dependency to your JavaScript file when enqueueing it.
wp_enqueue_script('shp_my_plugin_ui', shp_my_plugin_get_instance()->url . $loader_script, ['wp-api'], filemtime(shp_my_plugin_get_instance()->path . $loader_script), true);