5

Is there a list of available events for wp.media object? By doing some googling, I managed to find following events: for wp.media.view.Modal.prototype: open, ready - they are triggered, when user opens the Modal window.

The reason why I need this list is that I want to insert a select box on the right side, when user clicks an item on the Insert Media window. This select has to be formatted with Chosen library, but since the Backbone view is loaded only on user interaction, I need to know, on which event to initialize Chosen.

Please add other events in your answers.

0

You can install the plugin WordPress Media Javascript Guide. It explains with screenshots and examples the must use method of the wp.media object.

  • 2
    Thanks for the answer! This guide is definitely the best information source about wp.media that ir currently available in the internet, but it is still very far from being complete. For example, I wasn't able to find there events that I mentioned in the question. – Kārlis Baumanis Sep 29 '16 at 15:20
0

If you're still looking for this kind of answer, one way of figuring out what is firing is by entering this in your browser console and using the media modal:

wp.media.frame.on('all', function(e) { console.log(e); });

  • Thanks for this @thumbson Very helpful. Do you know how to listen to the events that create modals themselves? – onassar Jan 12 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.