The iframe sends some message events to its parent’s window object. To receive such events, you need to listen to JS ‘message’ events. Please note that this is not a Kudo specific mechanism but the native JavaScript message event is used so potentially you receive message events from other origin than Kudo iframe.
You can listen for dispatched messages by executing the following JavaScript:
window.addEventListener("message", (event) => { if (event.origin !== "http://example.org:8080") return; // ... }, false);
The properties of the dispatched message are:
origin - The origin of the window that sent the message. If you are using ARES Kudo SaaS, the origin is “https://app.kudo.graebert.com”.
data - The object passed from the iframe
Kudo sends data as a JSON object with a messageName string and a message object with some message dependent strings.
{ messageName: "nameOfTheMessage", message: {} }
Message Events
To avoid flooding parent with unnecessary messages, we have some type of message events you need to register for (https://graebert.atlassian.net/wiki/spaces/KUDOPARTNER/pages/1180500288/Message+Events+iframe+frame#Command-Events-you-need-to-register-for).
See https://graebert.atlassian.net/wiki/spaces/KUDOPARTNER/pages/1180139862/Messages#eventRegister%5BhardBreak%5DeventDeRegister how to register or deregister for such message events.
We have the following types of drawings events which notify the iframe parent , to avoid flooding parent with unnecessary messages, parent should get messages only if it has registered for them.
for event register or deregister, you can follow this
Events you need to register for
Command Events
These events are fired when a command executes:
Message Name | Descriptions |
---|---|
commandWillStart | whenever the execution of a command will start. |
commandEnded | whenevever the execution of a command has ended |
commandCancelled | whenevever the execution of a command has been canceled. |
commandFailed | whenevever the execution of a command has failed. |
modelessOperationWillStart | whenever a modeless operation is about to start. |
modelessOperationEnded | whenever a modeless operation has ended. |
Lisp Events
These events are fired when a lisp action is performed:
Message Name | Descriptions |
---|---|
lispEnded | whenevever the execution of a lisp has ended |
lispCancelled | whenevever the execution of a lisp has cancelled |
System Variables Events
These events are fired when a system variable change action is performed:
Message Name | Descriptions |
---|---|
sysvarChanged | Occurs when a change is made to the value of a system variable. |
Drawing Events
These events are fired when an action is performed on drawing:
Message Name | Descriptions |
---|---|
drawingSaved | when a drawing is saved. |
UploadBegin | when a drawing upload is going to start |
UploadComplete | when a drawing upload was done |
drawingDescription* | (*not implemented yet) |
drawingLoaded** | when drawing is entirely loaded on clientside. (** You don’t need to register for this Message Name) |
View Events
These events are fired when a view change action is performed:
Message Name | Descriptions |
---|---|
viewChanged | whenever the World to Eye transformation matrix has been changed. |
Selection Events
These events are fired when a selection action is performed:
Message Name | Descriptions |
---|---|
selectionChanged | when a change takes place to the current selection set. |
selectionCancelled | when a current selection is cancelled. |
Drawing Modified Events
These events are fired when a drawing edit action is performed:
Message Name | Descriptions |
---|---|
drawingModified | whenever any command or modeless operation is performed which could cause database modification. |