2017-09-26 12:43:25 -06:00
|
|
|
import { ISprinklersApi } from "@common/sprinklers";
|
2017-10-04 13:22:10 -06:00
|
|
|
import { MqttApiClient } from "@common/sprinklers/mqtt";
|
2017-09-10 11:23:54 -06:00
|
|
|
|
2017-09-10 12:30:23 -06:00
|
|
|
import { UiMessage, UiStore } from "./ui";
|
|
|
|
export { UiMessage, UiStore };
|
|
|
|
export * from "./inject";
|
|
|
|
|
2017-09-10 17:06:11 -06:00
|
|
|
export interface IState {
|
|
|
|
sprinklersApi: ISprinklersApi;
|
|
|
|
uiStore: UiStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class State implements IState {
|
2017-09-27 19:20:50 -06:00
|
|
|
sprinklersApi: ISprinklersApi = new MqttApiClient(`ws://${location.hostname}:1884`);
|
2017-09-10 11:23:54 -06:00
|
|
|
uiStore = new UiStore();
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.uiStore.addMessage({ header: "asdf", content: "boo!", error: true });
|
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
2017-09-10 17:06:11 -06:00
|
|
|
this.sprinklersApi.start();
|
2017-09-10 11:23:54 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-10 12:30:23 -06:00
|
|
|
// const state = new State();
|
2017-09-10 11:23:54 -06:00
|
|
|
|
2017-09-10 12:30:23 -06:00
|
|
|
// export default state;
|