Wp Customizer event for when a new widget has been added

In order to interact with the event “widget-added” , you should enqueue your JavaScript file using “customize_controls_enqueue_scripts” to avoid it being part of the repetitively loading preview iframe ( where $(document) is different from the parent page document).

I was able of interacting with the “widget-added” event using this example :

in theme’s functions.php

function custom_enqueue_scripts(){
    wp_enqueue_script( 'custom-script', get_template_directory_uri() . '/js/custom.js',array('jquery','customize-widgets'),'',1 );

}
add_action('customize_controls_enqueue_scripts','custom_enqueue_scripts',10);

JavaScript file :

jQuery(document).ready(function($) {


    $( document ).on( 'widget-added', function(event, widget) {
        console.log(widget);
    });



});