Theme Customizer controls API and me 04

Just a quick update on the multi image Customizer control experiment.

Moving code

Having found a way to hook into the JavaScript Customizer API my first step is to move the JavaScript code from the old file to the new one.
It’s not a big change and a lot of stuff is still not working (saving and sorting images) but it’s the ground I will iterate on to embrace the JavaScript Customizer API as much as possible.

A “gotcha”

When a user has selected some images using the WordPress Media Uploader I need to trigger an event telling the control that the new urls list is available.
To do that the wp.customize.Events object is available as an extension of the Backbone Events object and packing the same power.
Binding a function to it and triggering it (here and here) has deprecated creating an extension to the Events object of my own.

Next

Make it work, make it better.

I appreciate your input