Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 14 Next »

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 string that usually contains a JSON 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 (Events you need to register for).

See Event register/Event deregister how to register or deregister for such message events.

Sent events

drawingLoaded

Sent when drawing is entirely loaded on clientside.

event.data

{
  "messageName" : "drawingLoaded"
}

connectionLost

Sent when the connection to the server is lost due to e.g. network issues or server-side session terminated unexpectedly.

event.data

{
  "messageName" : "connectionLost"
}

showChooseDialog

Sent by some commands (e.g. xref, insert, linetype) to open file chooser dialog.

event.data

{
  "messageName" : "showChooseDialog",
  "message" : "{
    "attachmentType" : string,
    "commandType" : string,
    "filter" : array of strings,
    "wtObjectId" : string //optional
  }"
}

attachmentType - type to be passed to response message event (possible values: drawing/image/richLine/cfg/linetype/dgn)
commandType - messageName to be passed to response message event (possible values: xref/attach/-attach/import)
filter - array of extension to filter files for (e.g. [“dwg”,”dxf”] for drawings or ["jpg","jpeg","svg","png","bmp","gif"] for images)
wtObjectId - optional object id of the dialog that sent the message; if it is there → elemId to be passed to response message event

Kudo expects a response message event with data JSON object that contains the info about the selected file:

{
  messageName : string,  //has to match the "commandType" sent with "showChooseDialog" message event
  type : string,         //has to match the "attachmentType" sent with "showChooseDialog" message event
  fileInfo : {
    id : string,
    folderId : string,
    name : string,
    path : string,
    size : string,
    creationDate : date,
    updateDate : date,
    elemId : string     //has to matche the "wtObjectId" sent with "showChooseDialog" message even if it was sent (otherwise just undefined)
}

id - file id of the selected file that is used to download the file (/files/:fileId/diffs)
folderId - id of the folder the selected file is in
name - file name (e.g. “test.dwg”)
path - file path absolute to root (e.g. “~/folderX/fileY.png”)
size - file size as a string (e.g. "11.9 kB")
creationDate - file creation date
updateDate - date of the last file update

google-analytics-data

When in the server configuration "send-ganalytics-to-parent" is true then we send google-analytics data to parent iframe instead of google-analytic server

We send data to parent Iframe like this

{
"messageName":"google-analytics-data",
"hitType": string,
"components":string
}

Where hitType is pageView and component is ‘/editor’

OR

{
"messageName":"google-analyticsdata",
"hitType":string,
"eventCategory":string,
"eventAction":string,
"eventLabel":string
}

Where hitType is an event and for other parameters, please check this

https://graebert.atlassian.net/wiki/spaces/KUDOPARTNER/pages/2521726985/Google+Analytics+Configuration+and+Events#Google-Analytics-events

Events you need to register for

Command Events

Event name for registration: commandEvent

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

Event name for registration: lispEvent

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

Event name for registration: sysVarEvent

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

Event name for registration: drawingEvent

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)

View Events

Event name for registration: viewChangedEvent

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

Event name for registration: selectionEvent

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

Event name for registration: drawingModifiedEvent

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.


  • No labels