You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
901 B
33 lines
901 B
8 years ago
|
import * as React from "react";
|
||
|
import * as ReactDOM from "react-dom";
|
||
7 years ago
|
import { AppContainer } from "react-hot-loader";
|
||
8 years ago
|
|
||
7 years ago
|
import App from "@app/components/App";
|
||
|
import { MqttApiClient } from "@app/mqtt";
|
||
|
import { Message, UiStore } from "@app/ui";
|
||
8 years ago
|
|
||
|
const client = new MqttApiClient();
|
||
|
client.start();
|
||
|
const device = client.getDevice("grinklers");
|
||
8 years ago
|
const uiStore = new UiStore();
|
||
|
uiStore.addMessage(new Message("asdf", "boo!", Message.Type.Error));
|
||
8 years ago
|
|
||
8 years ago
|
const rootElem = document.getElementById("app");
|
||
8 years ago
|
|
||
7 years ago
|
const doRender = (Component: typeof App) => {
|
||
|
ReactDOM.render((
|
||
|
<AppContainer>
|
||
|
<Component device={device} uiStore={uiStore} />
|
||
|
</AppContainer>
|
||
|
), rootElem);
|
||
|
};
|
||
|
|
||
|
doRender(App);
|
||
8 years ago
|
|
||
|
if (module.hot) {
|
||
7 years ago
|
module.hot.accept("@app/components/App", () => {
|
||
|
const NextApp = require<any>("@app/components/App").default as typeof App;
|
||
7 years ago
|
doRender(NextApp);
|
||
8 years ago
|
});
|
||
|
}
|