Access add and remove events with the Craft Element Selector? Is there any way to access an event, and trigger some function, when an element is added / removed with the Craft Element Selector logic available in Garnish?

I am working on a custom field type and to keep everything tidy I only want to show a set of options when an asset is selected.
As of Craft 2.4.2688:


  It is now possible to access Craft.BaseElementSelectInput objects
  from their container elements, via .data('elementSelect').


On select element:

$('#theElementSelectField').data('elementSelect').on('selectElements', function(e) {
    console.log(e); // Take a look
    // Do stuff here when elements are selected...
});


On remove element:

$('#theElementSelectField').data('elementSelect').on('removeElements', function(e) {
    console.log(e);
    // Do stuff here when elements are removed...
});


NB. If you are using the Craft macros to build the select element inputs, make sure your javascript is run after craft has done its magic with the input field.



Thanks to Brandon Kelly &amp; Lindsey D