For example, you could call external code that needs to log into another system and return some data to your Lightning app. Let's call this event mynamespace:externalEvent. You'll fire this event when your non-Lightning code is done by including this JavaScript in your non-Lightning code.
var myExternalEvent; if(window.opener.$A && (myExternalEvent = window.opener.$A.get("e.mynamespace:externalEvent"))) { myExternalEvent.setParams({isOauthed:true}); myExternalEvent.fire(); }
window.opener.$A.get() references the master window where your Lightning app is loaded.