UNPKG

1.58 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const neweb_browser_1 = require("neweb-browser");
4const neweb_core_1 = require("neweb-core");
5const client_1 = require("neweb-react/client");
6const React = require("react");
7const ReactDOM = require("react-dom");
8const SocketIOClient = require("socket.io-client");
9const initial = window[neweb_core_1.INITIAL_VAR];
10const socket = SocketIOClient(window.location.protocol + "//" + window.location.host);
11const modulesManager = new neweb_browser_1.ModulesManager({
12 address: window.location.protocol + "//" + window.location.host + "/modules",
13 modules: [{
14 name: "react",
15 version: undefined,
16 type: "npm",
17 content: "",
18 exports: React,
19 },
20 {
21 name: "react-dom",
22 version: undefined,
23 type: "npm",
24 content: "",
25 exports: ReactDOM,
26 }],
27});
28const app = new neweb_browser_1.Application({
29 modulesManager,
30});
31const pageRenderer = new client_1.ClientPageRenderer({
32 app,
33 rootHtmlElement: document.getElementById("root"),
34});
35const pageMetaManager = new neweb_browser_1.PageMetaManager();
36const seance = new neweb_browser_1.Seance({
37 app,
38 seanceId: initial.seanceId,
39 socket,
40 pageRenderer,
41 pageMetaManager,
42});
43const logger = console;
44seance.initialize(initial).then(() => {
45 window.dispatchEvent(new Event("neweb-seans-initialized"));
46 logger.log("Initialized");
47});
48window.global = window;