// load global styling
require("../theme/index.scss");

import Mira from "./mira.jsx";

document.addEventListener("DOMContentLoaded", function() {

	let HOST_NAME = window.location.search.match(/hostname=([^&]*)/);
	HOST_NAME = HOST_NAME && HOST_NAME.length === 2 ? HOST_NAME[1] : window.location.hostname || "localhost";

	let PORT = window.location.search.match(/port=([0-9]*)/);
	PORT = PORT && PORT.length === 2 ? parseInt(PORT[1], 10) : 8086;

	Mira.init({
		port : PORT,
		hostname : HOST_NAME,
		element : document.getElementById("app-container")
	});
});

// load global styling
require("../theme/index.scss");

import Mira from "./mira.jsx";

document.addEventListener("DOMContentLoaded", function() {

	let HOST_NAME = window.location.search.match(/hostname=([^&]*)/);
	HOST_NAME = HOST_NAME && HOST_NAME.length === 2 ? HOST_NAME[1] : window.location.hostname || "localhost";

	let PORT = window.location.search.match(/port=([0-9]*)/);
	if (PORT && PORT.length === 2) {
		PORT = parseInt(PORT[1], 10);
	} else if (/^http(s)?:$/.test(window.location.protocol)) {
		PORT = parseInt(window.location.port, 10);
	}
	PORT = !PORT || isNaN(PORT) ? 8086 : PORT;

	Mira.init({
		port : PORT,
		hostname : HOST_NAME,
		element : document.getElementById("app-container")
	});
});

Use HTTP(S) port per default when serving from a server and no queryparam 'port' is set. If being served from a different protocol scheme fall back to 8086
Use HTTP(S) port per default when serving from a server and no queryparam 'port' is set. If being served from a different protocol scheme fall back to 8086
