onOverlayEvent
An overlay's lifecycle event: before it appears, once it is on screen, when the viewer engages it, when it goes away.
Type
assocArray: { type, payload }
Events
type | When | Payload, besides overlayId and associatedPanel |
|---|---|---|
will-appear | Before the overlay shows | canAppear, canFocus: the defaults for your build |
did-appear | The overlay is on screen | none |
did-engage | The viewer pressed OK on it | none |
did-dismiss | Timeout, Back or dismissOverlay() | focusRestoredBySDK |
| Payload field | Type | Description |
|---|---|---|
overlayId | string | The overlay's ID; echo it in your setDataToOverlay answer. |
associatedPanel | string | The panel type the overlay opens. |
canAppear | boolean | The default permission to appear. |
canFocus | boolean | The default permission to take focus. |
focusRestoredBySDK | boolean | false when the overlay held focus and the SDK didn't restore it: place focus yourself. |
Example
sub onMaestroOverlayEvent(event as object)
overlayEvent = event.getData()
payload = overlayEvent?.payload
if overlayEvent?.type = "will-appear"
m.maestro.setDataToOverlay = { overlayId: payload.overlayId, canAppear: true, canFocus: false }
else if overlayEvent?.type = "did-dismiss"
if payload.focusRestoredBySDK <> true then m.yourFocusTarget.setFocus(true)
end if
end sub
Notes
- Answer
will-appearat once withsetDataToOverlay; without an answer the SDK uses the defaults after a timeout. - On
did-engagethe SDK opensassociatedPaneland setsshowPanel = true. - See Overlay Integration.