{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/App.vue?7e02","webpack:///./src/components/Snake.vue?0320","webpack:///./src/App.vue?393b","webpack:///./src/App.vue","webpack:///./src/views/Home.vue?e894","webpack:///./src/components/Snake.vue?ba4b","webpack:///./src/components/Snake.vue","webpack:///./src/components/Snake.vue?197a","webpack:///./src/components/Snake.vue?627b","webpack:///./src/helpers/SnakeHelper.ts","webpack:///./src/views/Home.vue","webpack:///./src/views/Home.vue?2d60","webpack:///./src/views/Home.vue?c853","webpack:///./src/router/index.ts","webpack:///./src/main.ts"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","jsonpScriptSrc","p","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","window","oldJsonpFunction","slice","_vm","this","_h","$createElement","_c","_self","attrs","_v","staticRenderFns","component","staticClass","snake","apple","wsConnected","moveFunction","_l","ref","canvasId","makeid","characters","charactersLength","charAt","Math","floor","random","getRandomInt","min","max","grid","count","newVal","prev","isPlayer","registerSnakeGame","requestAnimationFrame","startSnakeLoop","canvas","getElementById","context","getContext","loaded","loadedWatcher","addEventListener","which","dx","dy","clearRect","width","height","x","y","cells","unshift","maxCells","pop","fillStyle","fillRect","forEach","cell","index","id","users","entries","filter","hn","url","URL","protocol","pathname","ws","WebSocket","toString","log","parsed","JSON","parse","evt","send","stringify","components","Snake","use","routes","path","router","config","productionTip","render","h","App","$mount"],"mappings":"a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AAM,OACN6C,UAAW,GAEb,CACE0E,KAAM,SACNvH,KAAM,QAIN6C,UAAW,kBAAM,0CAIf2E,EAAS,IAAI,OAAU,CAC3BF,WAGa,ICtBf,OAAIG,OAAOC,eAAgB,EAE3B,IAAI,OAAI,CACNF,OAAA,EACAG,OAAQ,SAAAC,GAAC,OAAIA,EAAEC,MACdC,OAAO,S","file":"js/app.c34ae825.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t\"app\": 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"js/\" + ({\"about\":\"about\"}[chunkId]||chunkId) + \".\" + {\"about\":\"99e3aa80\"}[chunkId] + \".js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([0,\"chunk-vendors\"]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","export * from \"-!../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./App.vue?vue&type=style&index=0&lang=css&\"","export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Snake.vue?vue&type=style&index=0&id=29b65b00&scoped=true&lang=css&\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"app\"}},[_c('div',{attrs:{\"id\":\"nav\"}},[_c('router-link',{attrs:{\"to\":\"/\"}},[_vm._v(\"Home\")]),_vm._v(\" | \"),_c('router-link',{attrs:{\"to\":\"/about\"}},[_vm._v(\"About\")])],1),_c('router-view')],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import { render, staticRenderFns } from \"./App.vue?vue&type=template&id=24a3caee&\"\nvar script = {}\nimport style0 from \"./App.vue?vue&type=style&index=0&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"home\"},[_c('Snake',{attrs:{\"snake\":_vm.snake,\"apple\":_vm.apple,\"isPlayer\":true,\"loaded\":_vm.wsConnected,\"moveFunction\":_vm.moveFunction}}),_vm._l((_vm.mappedUsers),function(ref){\nvar key = ref[0];\nvar value = ref[1];\nreturn _c('div',{key:key},[_c('Snake',{attrs:{\"snake\":value.snake,\"apple\":value.apple,\"isPlayer\":false,\"loaded\":true}})],1)})],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('canvas',{attrs:{\"width\":\"400\",\"height\":\"400\",\"id\":_vm.canvasId}})])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\nimport { Component, Prop, Vue, Watch } from 'vue-property-decorator'\nimport { Snake, Apple } from '../helpers/SnakeHelper'\n\nconst makeid = (length: number) => {\n let result = ''\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\n const charactersLength = characters.length\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength))\n }\n return result\n}\n\nfunction getRandomInt (min:number, max:number) {\n return Math.floor(Math.random() * (max - min)) + min\n}\n\n@Component\nexport default class SnakeComponent extends Vue {\n @Prop() private isPlayer!: boolean\n @Prop() private snake!: Snake\n @Prop() private apple!: Apple\n @Prop() public loaded!: boolean\n @Prop() private moveFunction!: (snake: Snake, apple: Apple) => void\n\n @Watch('loaded')\n loadedWatcher (newVal: boolean, prev: boolean): void {\n if (newVal === true) {\n if (this.isPlayer) {\n this.registerSnakeGame()\n }\n requestAnimationFrame(this.startSnakeLoop)\n }\n }\n\n public canvasId: string = makeid(5)\n\n grid = 16\n count = 0\n // @ts-ignore\n canvas: HTMLCanvasElement\n // @ts-ignore\n context: CanvasRenderingContext2D\n\n mounted (): void {\n this.canvas = document.getElementById(this.canvasId) as HTMLCanvasElement\n this.context = this.canvas.getContext('2d') as CanvasRenderingContext2D\n if (this.loaded) {\n this.loadedWatcher(true, true)\n }\n }\n\n registerSnakeGame (): void {\n document.addEventListener('keydown', (e) => {\n // prevent snake from backtracking on itself by checking that it's\n // not already moving on the same axis (pressing left while moving\n // left won't do anything, and pressing right while moving left\n // shouldn't let you collide with your own body)\n\n // left arrow key\n if (e.which === 37 && this.snake.dx === 0) {\n this.snake.dx = -this.grid\n this.snake.dy = 0\n }\n // up arrow key\n else if (e.which === 38 && this.snake.dy === 0) {\n this.snake.dy = -this.grid\n this.snake.dx = 0\n }\n // right arrow key\n else if (e.which === 39 && this.snake.dx === 0) {\n this.snake.dx = this.grid\n this.snake.dy = 0\n }\n // down arrow key\n else if (e.which === 40 && this.snake.dy === 0) {\n this.snake.dy = this.grid\n this.snake.dx = 0\n }\n })\n }\n\n startSnakeLoop (): void {\n requestAnimationFrame(this.startSnakeLoop)\n\n // slow game loop to 15 fps instead of 60 (60/15 = 4)\n if (++this.count < 4) {\n return\n }\n\n this.count = 0\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height)\n if (this.isPlayer) {\n // move snake by it's velocity\n this.snake.x += this.snake.dx\n this.snake.y += this.snake.dy\n\n // wrap snake position horizontally on edge of screen\n if (this.snake.x < 0) {\n this.snake.x = this.canvas.width - this.grid\n }\n else if (this.snake.x >= this.canvas.width) {\n this.snake.x = 0\n }\n\n // wrap snake position vertically on edge of screen\n if (this.snake.y < 0) {\n this.snake.y = this.canvas.height - this.grid\n }\n else if (this.snake.y >= this.canvas.height) {\n this.snake.y = 0\n }\n\n // keep track of where snake has been. front of the array is always the head\n this.snake.cells.unshift({ x: this.snake.x, y: this.snake.y })\n\n // remove cells as we move away from them\n if (this.snake.cells.length > this.snake.maxCells) {\n this.snake.cells.pop()\n }\n }\n\n // draw apple\n this.context.fillStyle = 'red'\n this.context.fillRect(this.apple.x, this.apple.y, this.grid - 1, this.grid - 1)\n\n // draw snake one cell at a time\n this.context.fillStyle = 'green'\n this.snake.cells.forEach((cell, index) => {\n // drawing 1 px smaller than the grid creates a grid effect in the snake body so you can see how long it is\n this.context.fillRect(cell.x, cell.y, this.grid - 1, this.grid - 1)\n if (this.isPlayer) {\n // snake ate apple\n if (cell.x === this.apple.x && cell.y === this.apple.y) {\n this.snake.maxCells++\n\n // canvas is 400x400 which is 25x25 grids\n this.apple.x = getRandomInt(0, 25) * this.grid\n this.apple.y = getRandomInt(0, 25) * this.grid\n }\n\n // check collision with all cells after this one (modified bubble sort)\n for (var i = index + 1; i < this.snake.cells.length; i++) {\n // snake occupies same space as a body part. reset game\n if (cell.x === this.snake.cells[i].x && cell.y === this.snake.cells[i].y) {\n this.snake.x = 160\n this.snake.y = 160\n this.snake.cells = []\n this.snake.maxCells = 4\n this.snake.dx = this.grid\n this.snake.dy = 0\n\n this.apple.x = getRandomInt(0, 25) * this.grid\n this.apple.y = getRandomInt(0, 25) * this.grid\n }\n }\n }\n })\n if (this.isPlayer) {\n this.moveFunction(this.snake, this.apple)\n }\n }\n}\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--14-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Snake.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--14-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Snake.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./Snake.vue?vue&type=template&id=29b65b00&scoped=true&\"\nimport script from \"./Snake.vue?vue&type=script&lang=ts&\"\nexport * from \"./Snake.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./Snake.vue?vue&type=style&index=0&id=29b65b00&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"29b65b00\",\n null\n \n)\n\nexport default component.exports","export interface XYCoords {\n x: number\n y: number\n}\nexport interface Snake extends XYCoords {\n dx: number\n dy: number\n cells: XYCoords[]\n maxCells: number\n}\n// eslint-disable-next-line\nexport interface Apple extends XYCoords {\n}\n\nexport const defaultSnake: (grid: number) => Snake = (grid: number) => {\n return {\n x: 160,\n y: 160,\n\n // snake velocity. moves one grid length every frame in either the x or y direction\n dx: grid,\n dy: 0,\n\n // keep track of all grids the snake body occupies\n cells: [],\n\n // length of the snake. grows when eating an apple\n maxCells: 4\n }\n}\n","\n\n\n\n\n\n\n\n\n\nimport { Component, Vue } from 'vue-property-decorator'\nimport SnakeComponent from '@/components/Snake.vue' // @ is an alias to /src\nimport { Snake, Apple, defaultSnake } from '../helpers/SnakeHelper'\ninterface User {\n id: string\n name: string\n snake: Snake\n apple: Apple\n}\n@Component({\n components: {\n Snake: SnakeComponent\n }\n})\nexport default class Home extends Vue {\n id = ''\n ws: WebSocket | undefined\n wsConnected = false\n users: {[key: string]: User} = {}\n get mappedUsers () {\n return Object.entries(this.users).filter(([key, value]) => {\n return key !== this.id && value.snake !== undefined\n })\n }\n\n mounted (): void {\n const hn = 'https://websocket.scotsoo.me'\n const url = new URL(hn)\n url.protocol = 'wss'\n url.pathname = '/websocket'\n this.ws = new WebSocket(url.toString())\n this.ws.addEventListener('open', () => {\n console.log('websocket open')\n this.wsConnected = true\n })\n this.ws.addEventListener('message', ({ data }) => {\n const parsed = JSON.parse(data) as {\n id: string\n users: { [key: string]: User }\n }\n this.users = parsed.users\n console.log(parsed.users)\n this.id = parsed.id\n })\n this.ws.addEventListener('close', (evt: unknown) => {\n console.log('Closed websocket')\n console.log(evt)\n })\n }\n\n moveFunction (): void {\n if (this.ws !== undefined) {\n this.ws.send(JSON.stringify({ type: 'SNAKE:MOVE', snake: this.snake, apple: this.apple }))\n }\n }\n\n defaultSnake (): Snake {\n return defaultSnake(16)\n }\n\n apple: Apple = {\n x: 320,\n y: 320\n }\n\n snake: Snake = defaultSnake(16)\n}\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--14-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--14-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./Home.vue?vue&type=template&id=c6b85238&\"\nimport script from \"./Home.vue?vue&type=script&lang=ts&\"\nexport * from \"./Home.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import Vue from 'vue'\nimport VueRouter, { RouteConfig } from 'vue-router'\nimport Home from '../views/Home.vue'\n\nVue.use(VueRouter)\n\nconst routes: Array = [\n {\n path: '/',\n name: 'Home',\n component: Home\n },\n {\n path: '/about',\n name: 'About',\n // route level code-splitting\n // this generates a separate chunk (about.[hash].js) for this route\n // which is lazy-loaded when the route is visited.\n component: () => import(/* webpackChunkName: \"about\" */ '../views/About.vue')\n }\n]\n\nconst router = new VueRouter({\n routes\n})\n\nexport default router\n","import Vue from 'vue'\nimport App from './App.vue'\nimport router from './router'\n\nVue.config.productionTip = false\n\nnew Vue({\n router,\n render: h => h(App)\n}).$mount('#app')\n"],"sourceRoot":""}