(data: DataToLoad, insight?: Partial<SandDance.specs.Insight>)
| 19 | export const requests: MessageRequestWithSource[] = []; |
| 20 | |
| 21 | export function load(data: DataToLoad, insight?: Partial<SandDance.specs.Insight>) { |
| 22 | return new Promise((resolve) => { |
| 23 | |
| 24 | const innerLoad = () => { |
| 25 | let getPartialInsight: (columns: SandDance.types.Column[]) => Partial<SandDance.specs.Insight>; |
| 26 | if (insight) { |
| 27 | //TODO make sure that insight columns exist in dataset |
| 28 | getPartialInsight = columns => insight; |
| 29 | } |
| 30 | sandDanceExplorer.load(data, getPartialInsight).then(resolve); |
| 31 | }; |
| 32 | |
| 33 | const create = () => { |
| 34 | SandDanceExplorer.use(FluentUIReact, React, ReactDOM, vega, deck, deck, luma); |
| 35 | const explorerProps: SandDanceExplorer.Props = { |
| 36 | logoClickUrl: 'https://microsoft.github.io/SandDance/', |
| 37 | mounted: explorer => { |
| 38 | sandDanceExplorer = explorer; |
| 39 | innerLoad(); |
| 40 | }, |
| 41 | }; |
| 42 | ReactDOM.render(React.createElement(SandDanceExplorer.Explorer, explorerProps), document.getElementById('app')); |
| 43 | }; |
| 44 | |
| 45 | if (sandDanceExplorer) { |
| 46 | innerLoad(); |
| 47 | } else { |
| 48 | create(); |
| 49 | } |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | export function respondToRequest(requestWithSource: MessageRequestWithSource) { |
| 54 | requests.push(requestWithSource); |
no test coverage detected