I'm building a hardware library for a project and using JQuery to trigger status updates.
There is an object called "objectName". This object is a hash of a set of objects denoted as "objectName.childName". Part of these objects is to connect and control hardware (think barcode scanners over USB to a webpage). At the end of the connection cycle, JQuery is used to trigger a "CONNECTED" event or other objects.
$(this.childName).trigger("CONNECTED");
//This is the call that fails to propagate (called within the objectName)
A recent change has required us to nest the navigational components into an iframe since the hardware connection is slow and freezing the hardware page is best. This means the code asking for a connection runs inside an iframe and connects to the parent frame. The connection works and both objects in the Application/IFrame page end up on the same state but the triggered event is not propagated to the iframe from the parent frame.
Application Page (Frozen) -> IFrame Page (Navigational Components)
The Question: How exactly do you capture all of the events emitted by the children of "objectName" and propagate them down to the iframe so the iframe may be notified of connections or other event types? Assume IE11 will be the target browser. The best solution would be some code that is run on the Application Page and does not modify the IFrame Page.
Here's what passing the object from one to the other looks like.
Application Page
window.requestObject = function (){
return objectName; //This is within the Application Page.
}
IFrame Page
window.objectName = window.parent.requestObject();
// This is called on every iframe navigation