2019-08-13 15:36:46 -04:00
|
|
|
/**
|
|
|
|
|
* Entry point index.js for UMD packaging
|
|
|
|
|
*/
|
2019-09-09 12:25:37 -04:00
|
|
|
import 'regenerator-runtime/runtime';
|
|
|
|
|
|
2019-08-13 15:36:46 -04:00
|
|
|
import React from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
import App from './App.js';
|
|
|
|
|
|
2019-12-09 14:47:23 -03:00
|
|
|
function installViewer(config, containerId = 'root', callback) {
|
2019-08-13 15:36:46 -04:00
|
|
|
const container = document.getElementById(containerId);
|
|
|
|
|
|
|
|
|
|
if (!container) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
"No root element found to install viewer. Please add a <div> with the id 'root', or pass a DOM element into the installViewer function."
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-09 14:47:23 -03:00
|
|
|
return ReactDOM.render(<App config={config} />, container, callback);
|
2019-08-13 15:36:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { App, installViewer };
|