Skip to main content

Embed SDK reference

Load the SDK from your Nextcloud instance: /index.php/apps/launchpad/embed-sdk/embed-sdk.esm.js (ES module) or /index.php/apps/launchpad/embed-sdk/embed-sdk.umd.js (global LaunchPadEmbed).

LaunchPadEmbed.render(container, config)​

Creates the embed's iframe in container and resolves with an embed instance once the embed has loaded and answered the handshake. Rejects when the config is incomplete, when the embed refuses (the error has a code, e.g. origin_mismatch, token_revoked) or when it does not answer within timeout milliseconds (default 10000).

Config
baseUrlLaunchPad's address, e.g. https://cloud.example.nl/index.php/apps/launchpad.
tokenThe embed token.
subjectTypewidget or dashboard.
subjectIdThe widget id or dashboard uuid the token names.
titleThe iframe's accessible title (default LaunchPad).
viewportsmall, medium, large or a width, for the usage figures.
timeoutMilliseconds to wait for an answer.

Embed instance​

Method
on(eventType, handler)Listen for an event; any number of listeners. Returns the instance.
off(eventType, handler?)Stop one listener, or all of an event. Returns the instance.
resize()Sends the container's size; resolves with {width, height} the embed took.
destroy()Removes the iframe and every listener; pending calls reject.

Events​

EventPayload
filterAppliedThe filter the visitor set.
drillDownWhat the visitor opened: {placementId, title, link, source: 'user-interaction'}. Sent when the token's scope is read-with-interactions with drillDown allowed; the visitor opens a tile.
exportThe export started.
error{error, message}, e.g. when the token is revoked while the page is open.

Messages​

Host and embed talk by postMessage, with types starting with launchpad-embed: (init, ready, error, event, resize, resized). The SDK accepts messages only from the embed's own window at the LaunchPad origin; the embed answers only a parent whose origin the token lists. Neither side ever posts to *.