Listen to events inside iFrame

jQuery's trigger() only triggers the callbacks that were added through .on() of its own instance. So the jQuery within your iframe is only going to trigger the callbacks that were set using that instance, not any set through the jQuery instance of your main page.

You could instead call dispatchEvent() passing in your own event object

document.dispatchEvent(new Event('preview.compiled'));

Or can instead use window.onMessage / window.postMessage or Broadcast Channel api with modern browsers

window.onMessage / window.postMessage, check browser support

//in main window
    //do something

//in iframe
  other:"other data to pass"
},"url of main window");

Broadcast Channel API onMessage/postMessage, check browser support

//Main window
var bc = new BroadcastChannel('preview:compiled');
bc.onmessage = function(message){

var bc = new BroadcastChannel('preview:compiled');
bc.postMessage('Some data');