UNPKG

@intuitionrobotics/thunderstorm

Version:
27 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppWrapper = void 0; exports.renderApp = renderApp; const React = require("react"); const react_router_dom_1 = require("react-router-dom"); // noinspection TypeScriptPreferShortImport` const HistoryModule_1 = require("../modules/HistoryModule"); const Thunder_1 = require("./Thunder"); const ts_common_1 = require("@intuitionrobotics/ts-common"); const client_1 = require("react-dom/client"); const AppWrapper = (props) => { const MainApp = Thunder_1.Thunder.getInstance().getMainApp(); if (!MainApp) throw new ts_common_1.ImplementationMissingException("mainApp was not specified!!"); return (React.createElement(react_router_dom_1.Router, { history: HistoryModule_1.BrowserHistoryModule.getHistory() }, React.createElement(MainApp, null))); }; exports.AppWrapper = AppWrapper; function renderApp(appId = "app") { const el = document.getElementById(appId); if (!el) throw new Error(`Could not find element with id ${appId}`); const root = (0, client_1.createRoot)(el); root.render(React.createElement(exports.AppWrapper, null)); } //# sourceMappingURL=AppWrapper.js.map