forked from hull-ships/hull-processor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
32 lines (27 loc) · 911 Bytes
/
index.jsx
File metadata and controls
32 lines (27 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* global Hull */
import { queryParams } from "./utils";
import React from "react";
import ReactDOM from "react-dom";
import App from "./app";
import superagent from "superagent";
import Promise from "bluebird";
import Engine from "./engine";
(function main() {
const { ship, organization, secret } = queryParams();
Hull.init({
appId: ship,
orgUrl: `https://${organization}`
});
Hull.ready((hull, currentUser, app) => {
const root = document.getElementById("app");
const engine = new Engine({ ship, organization, secret }, { ship: app, currentUser });
window.addEventListener("message", ({ data: message }) => {
console.log("Received message", message);
if (message && message.event === "ship.update" && message.ship) {
engine.updateShip(message.ship);
}
});
console.log(engine);
ReactDOM.render(<App engine={engine} />, root);
});
}());