API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagecreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignMetadatagetDesignTokeninitAppElementoverlay.registerOnCanOpenopenDesignrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDrag
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrl
appProcess.broadcastMessage
API reference for the appProcess.broadcastMessage method.
This version of the API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.
Broadcasts a message to all of the app's active processes, not including the current process.
Usage
Broadcast primitive values
import { appProcess } from '@canva/platform';// Broadcasting a stringappProcess.broadcastMessage('REFRESH_REQUESTED');// Broadcasting a numberappProcess.broadcastMessage(42);// Broadcasting a booleanappProcess.broadcastMessage(true);
TYPESCRIPT
Broadcast simple objects
import { appProcess } from '@canva/platform';appProcess.broadcastMessage({id: 'user-123',name: 'John Doe',active: true});
TYPESCRIPT
Broadcast complex objects
import { appProcess } from '@canva/platform';appProcess.broadcastMessage({type: 'DOCUMENT_UPDATE',timestamp: Date.now(),payload: {documentId: 'doc-123',version: 2,metadata: {title: 'Project Alpha',tags: ['draft', 'review-needed'],collaborators: [{ id: 'user-1', role: 'editor' },{ id: 'user-2', role: 'viewer' }]}}});
TYPESCRIPT
Parameters
message
any
RequiredThe message to be broadcasted. This can be any kind of structured data.
Returns
void