Constructor
new SpotfireMessageHandler(spotfireDocument, [frameOrigin], [debug])
A convenience class to use when you want to expose the SpotfireDocument instance located on the current page, so that it can be consumed through the SpotfireDocumentProxy class on a different frame. It uses the Message API under the hood to send instructions to the target frame.
Parameters:
Name | Type | Description |
---|---|---|
spotfireDocument
|
SpotfireDocument | the instance of SpotfireDocument to expose. |
[ frameOrigin = '*' ]
|
String | the origin of the frame you want to open to, or "*" for all. |
[ debug = false ]
|
Boolean | Whether to log extra debug information |
Example
// Instantiate the SpotfireMessageHandler to expose the spotfireDocument object instantiated on the page
const spotfireDocument = new SpotfireDocument({
serverUrl: 'https://spotfire.discngine.com',
documentPath: '/Discngine/Client Automation/empty'
});
const messageHandler = new SpotfireMessageHandler(spotfireDocument, 'http://other.discngine.com');
// From now on, every call emitted by the SpotfireDocumentProxy counterpart instantiated
// on the other frame located under http://other.discngine.com will be relayed to
// the spotfireDocument object.