Skip to main content

Messaging

buildfire.messaging#

Use messaging to communicate messages to and from the widget and control. This is usefull if you want to sync your cp with widget side emulator on Control Panel.

Methods#

sendMessageToControl()
#

buildfire.messaging.sendMessageToControl(message)

Send a message from the widget to the active control (content, design or settings)

buildfire.messaging.sendMessageToControl({
section: "details",
subItem: 123123123,
});

message#

NameTypeRequiredDescriptionDefault
messageanyyesMay be a simple data type or an object. Will be sent to the widget and will trigger the callback function buildfire.messaging.onReceivedMessage(message)

sendMessageToWidget()
#

buildfire.messaging.sendMessageToWidget(message)

Sends a message from the control to the widget emulator.

buildfire.messaging.sendMessageToWidget({
section: "details",
subItem: 123123123,
});

message#

NameTypeRequiredDescriptionDefault
messageanyyesMay be a simple data type or an object. Will be sent to the control and will trigger the callback function buildfire.messaging.onReceivedMessage(message)

sendMessageToService()
#

buildfire.messaging.sendMessageToService(message)

Sends a message from the widget to the widget background service.

buildfire.messaging.sendMessageToService({
section: "details",
subItem: 123123123,
});

message#

NameTypeRequiredDescriptionDefault
messageanyyesMay be a simple data type or an object. Will be sent to the control and will trigger the callback function buildfire.messaging.onReceivedMessage(message)

onReceivedMessage()
#

buildfire.messaging.onReceivedMessage(message)

Override this call back on widget, control or service to listen for any incoming messages

buildfire.messaging.onReceivedMessage = (message) => {
console.log("Message received", message);
};

message#

NameTypeDescription
messageanyMessage sent by widget, control or service depending where the lister is initiated