-
Notifications
You must be signed in to change notification settings - Fork 4
Internal API: underlying postMessage layer
Our Internal API is implemented on top of window.postMessage()
.
Messages from compat.js
to laskyawm.js
are {messageID, action, args}
objects.
messageID
is an ID which is included by laskyawm.js
in the response.
action
is a string with the name of the function, such as 'wm.focus'
.
args
is an array of arguments to be passed to the function, not including callback
-type functions.
These messages are first sent to laskyawm.js
, which forwards them to core.js
and also forwards back the response. Otherwise they are the same as wm.*
messages.
Note: for messages from compat.js
to core.js
, two messageID
s are used; one between compat.js
and laskyawm.js
, and one between laskyawm.js
and core.js
.
These messages are {inReplyTo, result, [progress]}
objects.
inReplyTo
is the messageID
this message is a response to.
result
is an array with the arguments callback
(or progress
, or listener
) was called with.
progress
: If progress
is true
, the message represents a call to progress
, not callback
.
laskyawm.js
's openFile()
also currently sends {action: 'openFile', args}
messages, which you can listen for with airborn.addEventListener('openFileRequest', listener)
. Both of these will probably be deprecated in favor of Web Activities.
core.js
forwards messages directly sent from apps to core.js
(window.top
) to compat.js
under the assumption they were meant to go there. This isn't perfect, though: many properties of the received message
object, such as message.source
, will be "wrong".