3.9.17.4Sending messages from the widget/script to the HTML

After creation, you can send messages from the widget/script to the HTML using ChartChange() with command: "send-html-message". For example:

Framework.ChartChange({

mode: "active", // or "all", or "single" plus a .chartId value

command: "send-html-message",

msg: "some update for the HTML"

});

The HTML can listen for the messages using standard window onmessage. For example:

var html = "<html>";

html += "<script>";

html += "window.addEventListener('message', event => {";

// event.data contains the message from the widget. For example:

html += "document.body.innerText = event.data;";

html += "});"

// See note above about escaping the closing script block in dynamically constructed HTML

html += "<\/script>";