Constructor
new SpotfireDocumentProxy(targetFrame, [targetOrigin], [timeout], [debug])
Parameters:
Name | Type | Description |
---|---|---|
targetFrame
|
Window | the window object which holds the instance of SpotfireDocument. Typically, if you are in a child frame, it would be |
[ targetOrigin = '*' ]
|
String | the origin of the targetFrame (eg http://parent.yourcompany.com) or wildcard '*' by default. |
[ timeout = 30000 ]
|
Number | the timeout is ms before a method call times out and returns an error. |
[ debug = false ]
|
Boolean | set to |
Examples
// Instanciate the SpotfireDocumentProxy to call the actual spotfireDocument object
// on the window.parent page located at 'http://pipelinepilot.discngine.com:3000'
const spotfireDocumentProxy = new SpotfireDocumentProxy(
window.parent,
'http://pipelinepilot.discngine.com:3000'
);
spotfireDocumentProxy
.getDataTableNamesAsync()
.then(res => console.log('data tables:', res))
.catch(err => console.error(err));
// For SpotfireDocumentEditor methods, calls cannot be chained and must be done sequentially, e.g.
async function createTableAndChart() {
await spotfireDocumentProxy.editor.addDataTable({...});
await spotfireDocumentProxy.editor.addTable();
await spotfireDocumentProxy.editor.applyState();
}