1
0
forked from MTSR/mapserver
mapserver/static/js/bundle-stats.js.map
2019-12-29 16:12:30 +01:00

1 line
5.6 KiB
Plaintext

{"version":3,"file":"bundle-stats.js","sources":["components/WorldStats.js","WebSocketChannel.js","stats.js"],"sourcesContent":["\nexport default function(info){\n\n var timeIcon = m(\"span\", { class: \"fa fa-sun\", style: \"color: orange;\" });\n\n if (info.time < 5500 || info.time > 19000) //0 - 24'000\n timeIcon = m(\"span\", { class: \"fa fa-moon\", style: \"color: blue;\" });\n\n function getHour(){\n return Math.floor(info.time/1000);\n }\n\n function getMinute(){\n var min = Math.floor((info.time % 1000) / 1000 * 60);\n return min > 10 ? min : \"0\" + min;\n }\n\n function getLag(){\n var color = \"green\";\n if (info.max_lag > 0.8)\n color = \"orange\";\n else if (info.max_lag > 1.2)\n color = \"red\";\n\n return [\n m(\"span\", { class: \"fa fa-wifi\", style: \"color: \" + color }),\n parseInt(info.max_lag*1000),\n \" ms\"\n ];\n }\n\n function getPlayers(){\n return [\n m(\"span\", { class: \"fa fa-users\" }),\n info.players ? info.players.length : \"0\"\n ];\n }\n\n return m(\"div\", [\n getPlayers(),\n \" \",\n getLag(),\n \" \",\n m(\"span\", { class: \"fa fa-clock\" }),\n timeIcon,\n getHour(), \":\", getMinute()\n ]);\n\n};\n","\nclass WebSocketChannel {\n constructor(){\n this.wsUrl = window.location.protocol.replace(\"http\", \"ws\") +\n \"//\" + window.location.host +\n window.location.pathname.substring(0, window.location.pathname.lastIndexOf(\"/\")) +\n \"/api/ws\";\n\n this.listenerMap = {/* type -> [listeners] */};\n }\n\n addListener(type, listener){\n var list = this.listenerMap[type];\n if (!list){\n list = [];\n this.listenerMap[type] = list;\n }\n\n list.push(listener);\n }\n\n removeListener(type, listener){\n var list = this.listenerMap[type];\n if (!list){\n return;\n }\n\n this.listenerMap[type] = list.filter(l => l != listener);\n }\n\n connect(){\n var ws = new WebSocket(this.wsUrl);\n var self = this;\n\n ws.onmessage = function(e){\n var event = JSON.parse(e.data);\n //rendered-tile, mapobject-created, mapobjects-cleared\n\n var listeners = self.listenerMap[event.type];\n if (listeners){\n listeners.forEach(function(listener){\n listener(event.data);\n });\n }\n };\n\n ws.onerror = function(){\n //reconnect after some time\n setTimeout(self.connect.bind(self), 1000);\n };\n }\n}\n\nexport default new WebSocketChannel();\n","\nimport WorldStats from './components/WorldStats.js';\nimport wsChannel from './WebSocketChannel.js';\n\nwsChannel.connect();\n\nwsChannel.addListener(\"minetest-info\", function(info){\n\tm.render(document.getElementById(\"app\"), WorldStats(info));\n});\n"],"names":[],"mappings":"6FACe,mBAAQ,CAAC,IAAI,CAAC;;EAE3B,IAAI,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC;;EAE1E,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,KAAK;IACvC,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;;EAEvE,SAAS,OAAO,EAAE;IAChB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;GACnC;;EAED,SAAS,SAAS,EAAE;IAClB,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;IACrD,OAAO,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;GACnC;;EAED,SAAS,MAAM,EAAE;IACf,IAAI,KAAK,GAAG,OAAO,CAAC;IACpB,IAAI,IAAI,CAAC,OAAO,GAAG,GAAG;MACpB,KAAK,GAAG,QAAQ,CAAC;SACd,IAAI,IAAI,CAAC,OAAO,GAAG,GAAG;MACzB,KAAK,GAAG,KAAK,CAAC;;IAE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