Is there a way to listen for an event when a user chooses an image from the WordPress Media Library/Uploader?
I'm developing an extension for a WordPress framework (Layers), which uses it's own controls for uploading images and I don't trigger the Uploader manually, which means I can't hook up to it's callback.
Is there a way to get the "global" media uploader, or the one that's currently open?
Something like:
wp.media().on('insert', function(url) {
console.log('isnerted image: ' + url);
});
I could not find anything in the WordPress Codex besides this example: http://codex.wordpress.org/Javascript_Reference/wp.media Which assumes that I'm launching the editor myself.