From 15fd2d5b5d4aca63408b8fea52a3c9b378c86498 Mon Sep 17 00:00:00 2001 From: Eugene Serb <46799701+eugene-serb@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:23:10 +0300 Subject: [PATCH] Updated change method --- docs/index.html | 2 +- docs/js/{app.b405c25e.js => app.621e321e.js} | 4 ++-- docs/js/app.621e321e.js.map | 1 + docs/js/app.b405c25e.js.map | 1 - src/components/WaveloversApp.vue | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) rename docs/js/{app.b405c25e.js => app.621e321e.js} (67%) create mode 100644 docs/js/app.621e321e.js.map delete mode 100644 docs/js/app.b405c25e.js.map diff --git a/docs/index.html b/docs/index.html index 5e903e1..26d10b9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -15,4 +15,4 @@ webvisor: true });

Wavelovers

\ No newline at end of file + }

Wavelovers

\ No newline at end of file diff --git a/docs/js/app.b405c25e.js b/docs/js/app.621e321e.js similarity index 67% rename from docs/js/app.b405c25e.js rename to docs/js/app.621e321e.js index 4526bee..f996dbf 100644 --- a/docs/js/app.b405c25e.js +++ b/docs/js/app.621e321e.js @@ -1,2 +1,2 @@ -(function(){"use strict";var t={1675:function(t,e,n){var a=n(9242),i=n(3396);function s(t,e,n,a,s,r){const o=(0,i.up)("WaveloversApp");return(0,i.wg)(),(0,i.j4)(o)}const r={class:"wavelovers"},o=(0,i.Uk)("Loading..."),c=(0,i.Uk)("Press any gamepad button or connect a new gamepad to vibrate.");function d(t,e,n,a,s,d){const p=(0,i.up)("PatternList"),u=(0,i.up)("MessageItem"),h=(0,i.up)("GamepadList");return(0,i.wg)(),(0,i.iD)("div",r,[t.patterns.length>0?((0,i.wg)(),(0,i.j4)(p,{key:0,patterns:t.patterns,mode:t.mode,isActive:t.isActive,onChange:t.change},null,8,["patterns","mode","isActive","onChange"])):((0,i.wg)(),(0,i.j4)(u,{key:1},{default:(0,i.w5)((()=>[o])),_:1})),t.gamepads.length>0?((0,i.wg)(),(0,i.j4)(h,{key:2,gamepads:t.gamepads},null,8,["gamepads"])):((0,i.wg)(),(0,i.j4)(u,{key:3},{default:(0,i.w5)((()=>[c])),_:1}))])}const p={class:"pattern-list"};function u(t,e,n,a,s,r){const o=(0,i.up)("PatternItem");return(0,i.wg)(),(0,i.iD)("div",p,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.patterns,((e,n)=>((0,i.wg)(),(0,i.j4)(o,{key:e.name,pattern:e,index:n,mode:t.mode,isActive:t.isActive,onChange:t.change},null,8,["pattern","index","mode","isActive","onChange"])))),128))])}var h=n(7139);const l=["textContent"],m=["textContent"];function v(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",{onClick:e[0]||(e[0]=e=>t.change(t.index)),class:(0,h.C_)(["pattern-item",t.index===t.mode&&!0===t.isActive?"pattern-item_selected":""])},[(0,i._)("span",{class:"pattern-item__icon",textContent:(0,h.zw)(t.pattern.icon)},null,8,l),(0,i._)("span",{class:"pattern-item__name",textContent:(0,h.zw)(t.pattern.name)},null,8,m)],2)}var g=(0,i.aZ)({name:"PatternItem",props:{pattern:{type:Object},index:{type:Number},mode:{type:Number},isActive:{type:Boolean}},methods:{change(t){this.$emit("change",t)}}}),f=n(89);const w=(0,f.Z)(g,[["render",v]]);var b=w,y=(0,i.aZ)({name:"PatternList",props:{patterns:{type:Array},mode:{type:Number},isActive:{type:Boolean}},components:{PatternItem:b},methods:{change(t){this.$emit("change",t)}}});const A=(0,f.Z)(y,[["render",u]]);var Z=A;const j={class:"device-list"};function x(t,e,n,a,s,r){const o=(0,i.up)("GamepadItem");return(0,i.wg)(),(0,i.iD)("div",j,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.gamepads,(t=>((0,i.wg)(),(0,i.j4)(o,{key:t.id,textContent:(0,h.zw)(t.unit.id)},null,8,["textContent"])))),128))])}const k={class:"list-item"};function C(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",k)}var _=(0,i.aZ)({name:"GamepadItem"});const O=(0,f.Z)(_,[["render",C]]);var P=O,G=(0,i.aZ)({name:"GamepadList",props:{gamepads:{type:Array}},components:{GamepadItem:P}});const I=(0,f.Z)(G,[["render",x]]);var L=I;const D={class:"message"};function E(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",D,[(0,i._)("span",null,[(0,i.WI)(t.$slots,"default")])])}var V=(0,i.aZ)({name:"MessageItem"});const M=(0,f.Z)(V,[["render",E]]);var W=M,z=n(2482);class N{constructor(t){(0,z.Z)(this,"id",void 0),(0,z.Z)(this,"canVibrate",void 0),(0,z.Z)(this,"isVibrating",void 0),(0,z.Z)(this,"unit",void 0),(0,z.Z)(this,"pattern",void 0),this.unit=t,this.id=Date.now(),this.canVibrate=!!this.unit.vibrationActuator,this.isVibrating=!1,this.pattern=[]}update(){const t=navigator.getGamepads();this.unit=t[this.unit.index]}reset(){this.isVibrating=!1,this.unit.vibrationActuator.reset()}async vibrate(t){this.isVibrating=!0,this.pattern=t;while(!0===this.isVibrating)for(let t=0;tsetTimeout(e,t)))}}var T=N,$=(0,i.aZ)({name:"WaveloversApp",components:{PatternList:Z,GamepadList:L,MessageItem:W},data:()=>({gamepads:[],patterns:[],isActive:!1,mode:0}),methods:{loadPatterns:async function(){const t="https://wavelovers.ru/assets/patterns.json";try{const e=await fetch(t);if(e.ok){let t=await e.json();this.patterns=t}else console.log("Connect to the Internet for download more patterns...")}catch(e){console.log(e)}},addEventListeners(){window.addEventListener("gamepadconnected",(t=>this.addGamepad(t))),window.addEventListener("gamepaddisconnected",(t=>this.deleteGamepad(t)))},addGamepad(t){const e=t;this.gamepads.length>=1||this.gamepads.push(new T(e.gamepad))},deleteGamepad(t){this.gamepads.forEach(((e,n)=>{e.unit.id===t.gamepad.id&&this.gamepads.splice(n,1)}))},change(t){this.mode===t?(this.isActive=!this.isActive,this.reset()):(this.isActive=!0,this.mode=t),!0===this.isActive&&(this.reset(),this.vibrate())},vibrate(){this.gamepads.forEach((t=>{t.vibrate(this.patterns[this.mode].pattern)}))},reset(){this.gamepads.forEach((t=>{t.reset()}))}},mounted(){this.loadPatterns(),this.addEventListeners()}});const B=(0,f.Z)($,[["render",d]]);var H=B,K=(0,i.aZ)({name:"App",components:{WaveloversApp:H}});const U=(0,f.Z)(K,[["render",s]]);var Y=U;(0,a.ri)(Y).mount("#app")}},e={};function n(a){var i=e[a];if(void 0!==i)return i.exports;var s=e[a]={exports:{}};return t[a](s,s.exports,n),s.exports}n.m=t,function(){var t=[];n.O=function(e,a,i,s){if(!a){var r=1/0;for(p=0;p=s)&&Object.keys(n.O).every((function(t){return n.O[t](a[c])}))?a.splice(c--,1):(o=!1,s0&&t[p-1][2]>s;p--)t[p]=t[p-1];t[p]=[a,i,s]}}(),function(){n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,{a:e}),e}}(),function(){n.d=function(t,e){for(var a in e)n.o(e,a)&&!n.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){var t={143:0};n.O.j=function(e){return 0===t[e]};var e=function(e,a){var i,s,r=a[0],o=a[1],c=a[2],d=0;if(r.some((function(e){return 0!==t[e]}))){for(i in o)n.o(o,i)&&(n.m[i]=o[i]);if(c)var p=c(n)}for(e&&e(a);d0?((0,i.wg)(),(0,i.j4)(p,{key:0,patterns:t.patterns,mode:t.mode,isActive:t.isActive,onChange:t.change},null,8,["patterns","mode","isActive","onChange"])):((0,i.wg)(),(0,i.j4)(u,{key:1},{default:(0,i.w5)((()=>[o])),_:1})),t.gamepads.length>0?((0,i.wg)(),(0,i.j4)(h,{key:2,gamepads:t.gamepads},null,8,["gamepads"])):((0,i.wg)(),(0,i.j4)(u,{key:3},{default:(0,i.w5)((()=>[c])),_:1}))])}const p={class:"pattern-list"};function u(t,e,n,a,s,r){const o=(0,i.up)("PatternItem");return(0,i.wg)(),(0,i.iD)("div",p,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.patterns,((e,n)=>((0,i.wg)(),(0,i.j4)(o,{key:e.name,pattern:e,index:n,mode:t.mode,isActive:t.isActive,onChange:t.change},null,8,["pattern","index","mode","isActive","onChange"])))),128))])}var h=n(7139);const l=["textContent"],m=["textContent"];function v(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",{onClick:e[0]||(e[0]=e=>t.change(t.index)),class:(0,h.C_)(["pattern-item",t.index===t.mode&&!0===t.isActive?"pattern-item_selected":""])},[(0,i._)("span",{class:"pattern-item__icon",textContent:(0,h.zw)(t.pattern.icon)},null,8,l),(0,i._)("span",{class:"pattern-item__name",textContent:(0,h.zw)(t.pattern.name)},null,8,m)],2)}var g=(0,i.aZ)({name:"PatternItem",props:{pattern:{type:Object},index:{type:Number},mode:{type:Number},isActive:{type:Boolean}},methods:{change(t){this.$emit("change",t)}}}),f=n(89);const w=(0,f.Z)(g,[["render",v]]);var b=w,y=(0,i.aZ)({name:"PatternList",props:{patterns:{type:Array},mode:{type:Number},isActive:{type:Boolean}},components:{PatternItem:b},methods:{change(t){this.$emit("change",t)}}});const A=(0,f.Z)(y,[["render",u]]);var Z=A;const j={class:"device-list"};function x(t,e,n,a,s,r){const o=(0,i.up)("GamepadItem");return(0,i.wg)(),(0,i.iD)("div",j,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.gamepads,(t=>((0,i.wg)(),(0,i.j4)(o,{key:t.id,textContent:(0,h.zw)(t.unit.id)},null,8,["textContent"])))),128))])}const k={class:"list-item"};function C(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",k)}var _=(0,i.aZ)({name:"GamepadItem"});const O=(0,f.Z)(_,[["render",C]]);var P=O,G=(0,i.aZ)({name:"GamepadList",props:{gamepads:{type:Array}},components:{GamepadItem:P}});const I=(0,f.Z)(G,[["render",x]]);var L=I;const D={class:"message"};function E(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",D,[(0,i._)("span",null,[(0,i.WI)(t.$slots,"default")])])}var V=(0,i.aZ)({name:"MessageItem"});const M=(0,f.Z)(V,[["render",E]]);var W=M,z=n(2482);class N{constructor(t){(0,z.Z)(this,"id",void 0),(0,z.Z)(this,"canVibrate",void 0),(0,z.Z)(this,"isVibrating",void 0),(0,z.Z)(this,"unit",void 0),(0,z.Z)(this,"pattern",void 0),this.unit=t,this.id=Date.now(),this.canVibrate=!!this.unit.vibrationActuator,this.isVibrating=!1,this.pattern=[]}update(){const t=navigator.getGamepads();this.unit=t[this.unit.index]}reset(){this.isVibrating=!1,this.unit.vibrationActuator.reset()}async vibrate(t){this.isVibrating=!0,this.pattern=t;while(!0===this.isVibrating)for(let t=0;tsetTimeout(e,t)))}}var T=N,$=(0,i.aZ)({name:"WaveloversApp",components:{PatternList:Z,GamepadList:L,MessageItem:W},data:()=>({gamepads:[],patterns:[],isActive:!1,mode:0}),methods:{loadPatterns:async function(){const t="https://wavelovers.ru/assets/patterns.json";try{const e=await fetch(t);if(e.ok){let t=await e.json();this.patterns=t}else console.log("Connect to the Internet for download more patterns...")}catch(e){console.log(e)}},addEventListeners(){window.addEventListener("gamepadconnected",(t=>this.addGamepad(t))),window.addEventListener("gamepaddisconnected",(t=>this.deleteGamepad(t)))},addGamepad(t){const e=t;this.gamepads.length>=1||this.gamepads.push(new T(e.gamepad))},deleteGamepad(t){this.gamepads.forEach(((e,n)=>{e.unit.id===t.gamepad.id&&this.gamepads.splice(n,1)}))},change(t){this.mode===t?this.isActive=!this.isActive:(this.isActive=!0,this.mode=t),!0===this.isActive?(this.reset(),this.vibrate()):this.reset()},vibrate(){this.gamepads.forEach((t=>{t.vibrate(this.patterns[this.mode].pattern)}))},reset(){this.gamepads.forEach((t=>{t.reset()}))}},mounted(){this.loadPatterns(),this.addEventListeners()}});const B=(0,f.Z)($,[["render",d]]);var H=B,K=(0,i.aZ)({name:"App",components:{WaveloversApp:H}});const U=(0,f.Z)(K,[["render",s]]);var Y=U;(0,a.ri)(Y).mount("#app")}},e={};function n(a){var i=e[a];if(void 0!==i)return i.exports;var s=e[a]={exports:{}};return t[a](s,s.exports,n),s.exports}n.m=t,function(){var t=[];n.O=function(e,a,i,s){if(!a){var r=1/0;for(p=0;p=s)&&Object.keys(n.O).every((function(t){return n.O[t](a[c])}))?a.splice(c--,1):(o=!1,s0&&t[p-1][2]>s;p--)t[p]=t[p-1];t[p]=[a,i,s]}}(),function(){n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,{a:e}),e}}(),function(){n.d=function(t,e){for(var a in e)n.o(e,a)&&!n.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){var t={143:0};n.O.j=function(e){return 0===t[e]};var e=function(e,a){var i,s,r=a[0],o=a[1],c=a[2],d=0;if(r.some((function(e){return 0!==t[e]}))){for(i in o)n.o(o,i)&&(n.m[i]=o[i]);if(c)var p=c(n)}for(e&&e(a);d 0)\n ? (_openBlock(), _createBlock(_component_PatternList, {\n key: 0,\n patterns: _ctx.patterns,\n mode: _ctx.mode,\n isActive: _ctx.isActive,\n onChange: _ctx.change\n }, null, 8, [\"patterns\", \"mode\", \"isActive\", \"onChange\"]))\n : (_openBlock(), _createBlock(_component_MessageItem, { key: 1 }, {\n default: _withCtx(() => [\n _hoisted_2\n ]),\n _: 1\n })),\n (_ctx.gamepads.length > 0)\n ? (_openBlock(), _createBlock(_component_GamepadList, {\n key: 2,\n gamepads: _ctx.gamepads\n }, null, 8, [\"gamepads\"]))\n : (_openBlock(), _createBlock(_component_MessageItem, { key: 3 }, {\n default: _withCtx(() => [\n _hoisted_3\n ]),\n _: 1\n }))\n ]))\n}","import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"pattern-list\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_PatternItem = _resolveComponent(\"PatternItem\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.patterns, (pattern, index) => {\n return (_openBlock(), _createBlock(_component_PatternItem, {\n key: pattern.name,\n pattern: pattern,\n index: index,\n mode: _ctx.mode,\n isActive: _ctx.isActive,\n onChange: _ctx.change\n }, null, 8, [\"pattern\", \"index\", \"mode\", \"isActive\", \"onChange\"]))\n }), 128))\n ]))\n}","import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = [\"textContent\"]\nconst _hoisted_2 = [\"textContent\"]\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", {\n onClick: _cache[0] || (_cache[0] = ($event: any) => (_ctx.change(_ctx.index))),\n class: _normalizeClass(['pattern-item',\r\n _ctx.index === _ctx.mode && _ctx.isActive === true ?\r\n 'pattern-item_selected' : '',\r\n ])\n }, [\n _createElementVNode(\"span\", {\n class: \"pattern-item__icon\",\n textContent: _toDisplayString(_ctx.pattern.icon)\n }, null, 8, _hoisted_1),\n _createElementVNode(\"span\", {\n class: \"pattern-item__name\",\n textContent: _toDisplayString(_ctx.pattern.name)\n }, null, 8, _hoisted_2)\n ], 2))\n}","\r\n import { defineComponent } from 'vue';\r\n\r\n export default defineComponent({\r\n name: 'PatternItem',\r\n props: {\r\n pattern: {\r\n type: Object,\r\n },\r\n index: {\r\n type: Number,\r\n },\r\n mode: {\r\n type: Number,\r\n },\r\n isActive: {\r\n type: Boolean,\r\n },\r\n },\r\n methods: {\r\n change(index: number): void {\r\n this.$emit('change', index as number);\r\n },\r\n },\r\n });\r\n","import { render } from \"./PatternItem.vue?vue&type=template&id=e1c2f044&ts=true\"\nimport script from \"./PatternItem.vue?vue&type=script&lang=ts\"\nexport * from \"./PatternItem.vue?vue&type=script&lang=ts\"\n\nimport \"./PatternItem.vue?vue&type=style&index=0&id=e1c2f044&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\r\n import { defineComponent } from 'vue';\r\n import PatternItem from '@/components/PatternItem.vue';\r\n\r\n export default defineComponent({\r\n name: 'PatternList',\r\n props: {\r\n patterns: {\r\n type: Array,\r\n },\r\n mode: {\r\n type: Number,\r\n },\r\n isActive: {\r\n type: Boolean,\r\n },\r\n },\r\n components: {\r\n PatternItem: PatternItem,\r\n },\r\n methods: {\r\n change(index: number): void {\r\n this.$emit('change', index as number);\r\n },\r\n },\r\n });\r\n","import { render } from \"./PatternList.vue?vue&type=template&id=77356b3f&ts=true\"\nimport script from \"./PatternList.vue?vue&type=script&lang=ts\"\nexport * from \"./PatternList.vue?vue&type=script&lang=ts\"\n\nimport \"./PatternList.vue?vue&type=style&index=0&id=77356b3f&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, toDisplayString as _toDisplayString, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"device-list\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_GamepadItem = _resolveComponent(\"GamepadItem\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.gamepads, (gamepad) => {\n return (_openBlock(), _createBlock(_component_GamepadItem, {\n key: gamepad.id,\n textContent: _toDisplayString(gamepad.unit.id)\n }, null, 8, [\"textContent\"]))\n }), 128))\n ]))\n}","import { openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"list-item\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1))\n}","\r\n import { defineComponent } from 'vue';\r\n\r\n export default defineComponent({\r\n name: 'GamepadItem',\r\n });\r\n","import { render } from \"./GamepadItem.vue?vue&type=template&id=e6e6c988&ts=true\"\nimport script from \"./GamepadItem.vue?vue&type=script&lang=ts\"\nexport * from \"./GamepadItem.vue?vue&type=script&lang=ts\"\n\nimport \"./GamepadItem.vue?vue&type=style&index=0&id=e6e6c988&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\r\n import { defineComponent } from 'vue';\r\n import GamepadItem from '@/components/GamepadItem.vue';\r\n\r\n export default defineComponent({\r\n name: 'GamepadList',\r\n props: {\r\n gamepads: {\r\n type: Array,\r\n },\r\n },\r\n components: {\r\n GamepadItem: GamepadItem,\r\n },\r\n });\r\n ","import { render } from \"./GamepadList.vue?vue&type=template&id=1d58b1c0&ts=true\"\nimport script from \"./GamepadList.vue?vue&type=script&lang=ts\"\nexport * from \"./GamepadList.vue?vue&type=script&lang=ts\"\n\nimport \"./GamepadList.vue?vue&type=style&index=0&id=1d58b1c0&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { renderSlot as _renderSlot, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"message\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createElementVNode(\"span\", null, [\n _renderSlot(_ctx.$slots, \"default\")\n ])\n ]))\n}","\r\n import { defineComponent } from 'vue';\r\n\r\n export default defineComponent({\r\n name: 'MessageItem',\r\n });\r\n","import { render } from \"./MessageItem.vue?vue&type=template&id=32e2819b&ts=true\"\nimport script from \"./MessageItem.vue?vue&type=script&lang=ts\"\nexport * from \"./MessageItem.vue?vue&type=script&lang=ts\"\n\nimport \"./MessageItem.vue?vue&type=style&index=0&id=32e2819b&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import TPatternUnit from '@/models/TPatternUnit';\r\nimport IGamepad from '@/models/IGamepad';\r\nimport IVibrator from '@/models/IVibrator';\r\n\r\nclass Vibrator implements IVibrator {\r\n readonly id: number;\r\n readonly canVibrate: boolean;\r\n isVibrating: boolean;\r\n unit: IGamepad;\r\n pattern: TPatternUnit[];\r\n\r\n constructor(unit: IGamepad) {\r\n this.unit = unit;\r\n this.id = Date.now();\r\n this.canVibrate = (this.unit.vibrationActuator) ? true : false;\r\n this.isVibrating = false;\r\n this.pattern = [];\r\n }\r\n\r\n update(): void {\r\n const gamepads = navigator.getGamepads();\r\n this.unit = gamepads[this.unit.index];\r\n }\r\n\r\n reset(): void {\r\n this.isVibrating = false;\r\n this.unit.vibrationActuator.reset();\r\n }\r\n\r\n async vibrate(pattern: TPatternUnit[]) {\r\n this.isVibrating = true;\r\n this.pattern = pattern;\r\n\r\n while (this.isVibrating === true) {\r\n for (let i = 0; i < this.pattern.length; i++) {\r\n if (this.isVibrating === true) {\r\n this.unit.vibrationActuator.playEffect('dual-rumble', this.pattern[i]);\r\n await this.sleep(this.pattern[i].startDelay + this.pattern[i].duration);\r\n } else {\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n\r\n sleep(ms: number): Promise {\r\n return new Promise(resolve => setTimeout(resolve, ms));\r\n }\r\n}\r\n\r\nexport default Vibrator;\r\n\r\n","\r\n import { defineComponent } from 'vue';\r\n import PatternList from '@/components/PatternList.vue';\r\n import GamepadList from '@/components/GamepadList.vue';\r\n import MessageItem from '@/components/MessageItem.vue';\r\n import IGamepadEvent from '@/models/IGamepadEvent';\r\n import IGamepad from '@/models/IGamepad';\r\n import TPattern from '@/models/TPattern';\r\n import TPatternUnit from '@/models/TPatternUnit';\r\n import Vibrator from '@/models/Vibrator';\r\n \r\n export default defineComponent({\r\n name: 'WaveloversApp',\r\n components: {\r\n PatternList: PatternList,\r\n GamepadList: GamepadList,\r\n MessageItem: MessageItem,\r\n },\r\n data: () => {\r\n return {\r\n gamepads: [] as Vibrator[],\r\n patterns: [] as TPattern[],\r\n isActive: false,\r\n mode: 0,\r\n };\r\n },\r\n methods: {\r\n loadPatterns: async function () {\r\n const url = 'https://wavelovers.ru/assets/patterns.json';\r\n try {\r\n const response = await fetch(url);\r\n if (response.ok) {\r\n let json = await response.json();\r\n this.patterns = json;\r\n } else {\r\n console.log('Connect to the Internet for download more patterns...');\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n },\r\n addEventListeners(): void {\r\n window.addEventListener('gamepadconnected', (event: GamepadEvent) => this.addGamepad(event));\r\n window.addEventListener('gamepaddisconnected', (event: GamepadEvent) => this.deleteGamepad(event));\r\n },\r\n addGamepad(event: GamepadEvent) {\r\n const ievent: IGamepadEvent = event as unknown as IGamepadEvent;\r\n if (this.gamepads.length >= 1) {\r\n return;\r\n } else {\r\n this.gamepads.push(new Vibrator(ievent.gamepad as IGamepad));\r\n }\r\n },\r\n deleteGamepad(event: GamepadEvent): void {\r\n this.gamepads.forEach((gamepad, index) => {\r\n if (gamepad.unit.id === event.gamepad.id) {\r\n this.gamepads.splice(index, 1);\r\n }\r\n });\r\n },\r\n change(index: number): void {\r\n if (this.mode === index) {\r\n this.isActive = !this.isActive;\r\n } else {\r\n this.isActive = true;\r\n this.mode = index;\r\n }\r\n if (this.isActive === true) {\r\n this.reset();\r\n this.vibrate();\r\n } else {\r\n this.reset();\r\n }\r\n },\r\n vibrate(): void {\r\n this.gamepads.forEach(gamepad => {\r\n gamepad.vibrate(this.patterns[this.mode].pattern as TPatternUnit[]);\r\n });\r\n },\r\n reset(): void {\r\n this.gamepads.forEach(gamepad => {\r\n gamepad.reset();\r\n });\r\n },\r\n },\r\n mounted() {\r\n this.loadPatterns();\r\n this.addEventListeners();\r\n },\r\n });\r\n","import { render } from \"./WaveloversApp.vue?vue&type=template&id=7db03f7a&ts=true\"\nimport script from \"./WaveloversApp.vue?vue&type=script&lang=ts\"\nexport * from \"./WaveloversApp.vue?vue&type=script&lang=ts\"\n\nimport \"./WaveloversApp.vue?vue&type=style&index=0&id=7db03f7a&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\n import { defineComponent } from 'vue';\n import WaveloversApp from '@/components/WaveloversApp.vue';\n\n export default defineComponent({\n name: 'App',\n components: {\n WaveloversApp: WaveloversApp,\n },\n });\n","import { render } from \"./App.vue?vue&type=template&id=4be8096e&ts=true\"\nimport script from \"./App.vue?vue&type=script&lang=ts\"\nexport * from \"./App.vue?vue&type=script&lang=ts\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createApp } from 'vue';\nimport App from './App.vue';\n\ncreateApp(App).mount('#app');\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t143: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkwavelovers\"] = self[\"webpackChunkwavelovers\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [998], function() { return __webpack_require__(5618); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["render","_ctx","_cache","$props","$setup","$data","$options","_component_WaveloversApp","_resolveComponent","_openBlock","_createBlock","_hoisted_1","class","_hoisted_2","_createTextVNode","_hoisted_3","_component_PatternList","_component_MessageItem","_component_GamepadList","_createElementBlock","patterns","length","key","mode","isActive","onChange","change","default","_withCtx","_","gamepads","_component_PatternItem","_Fragment","_renderList","pattern","index","name","onClick","$event","_normalizeClass","_createElementVNode","textContent","_toDisplayString","icon","defineComponent","props","type","Object","Number","Boolean","methods","this","$emit","__exports__","Array","components","PatternItem","_component_GamepadItem","gamepad","id","unit","GamepadItem","_renderSlot","$slots","Vibrator","constructor","Date","now","canVibrate","vibrationActuator","isVibrating","update","navigator","getGamepads","reset","i","playEffect","sleep","startDelay","duration","ms","Promise","resolve","setTimeout","PatternList","GamepadList","MessageItem","data","loadPatterns","async","url","response","fetch","ok","json","console","log","error","addEventListeners","window","addEventListener","event","addGamepad","deleteGamepad","ievent","push","forEach","splice","vibrate","mounted","WaveloversApp","createApp","App","mount","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","m","deferred","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","r","n","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","g","globalThis","Function","e","obj","prop","prototype","hasOwnProperty","call","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","chunkLoadingGlobal","self","bind","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/js/app.b405c25e.js.map b/docs/js/app.b405c25e.js.map deleted file mode 100644 index bd15e78..0000000 --- a/docs/js/app.b405c25e.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"js/app.b405c25e.js","mappings":"6EAEM,SAAUA,EAAOC,EAAUC,EAAYC,EAAYC,EAAYC,EAAWC,GAC9E,MAAMC,GAA2BC,EAAAA,EAAAA,IAAkB,iBAEnD,OAAQC,EAAAA,EAAAA,OAAcC,EAAAA,EAAAA,IAAaH,EACpC,CCJD,MAAMI,EAAa,CAAEC,MAAO,cACtBC,GAA0BC,EAAAA,EAAAA,IAAiB,cAC3CC,GAA0BD,EAAAA,EAAAA,IAAiB,iEAE3C,SAAUd,EAAOC,EAAUC,EAAYC,EAAYC,EAAYC,EAAWC,GAC9E,MAAMU,GAAyBR,EAAAA,EAAAA,IAAkB,eAC3CS,GAAyBT,EAAAA,EAAAA,IAAkB,eAC3CU,GAAyBV,EAAAA,EAAAA,IAAkB,eAEjD,OAAQC,EAAAA,EAAAA,OAAcU,EAAAA,EAAAA,IAAoB,MAAOR,EAAY,CAC1DV,EAAKmB,SAASC,OAAS,IACnBZ,EAAAA,EAAAA,OAAcC,EAAAA,EAAAA,IAAaM,EAAwB,CAClDM,IAAK,EACLF,SAAUnB,EAAKmB,SACfG,KAAMtB,EAAKsB,KACXC,SAAUvB,EAAKuB,SACfC,SAAUxB,EAAKyB,QACd,KAAM,EAAG,CAAC,WAAY,OAAQ,WAAY,gBAC5CjB,EAAAA,EAAAA,OAAcC,EAAAA,EAAAA,IAAaO,EAAwB,CAAEK,IAAK,GA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/./src/components/WaveloversApp.vue?13e1","webpack://wavelovers/./src/components/PatternList.vue?0478","webpack://wavelovers/./src/components/PatternItem.vue?0493","webpack://wavelovers/./src/components/PatternItem.vue?80c2","webpack://wavelovers/./src/components/PatternItem.vue","webpack://wavelovers/./src/components/PatternList.vue?eb4b","webpack://wavelovers/./src/components/PatternList.vue","webpack://wavelovers/./src/components/GamepadList.vue?05aa","webpack://wavelovers/./src/components/GamepadItem.vue?d49b","webpack://wavelovers/./src/components/GamepadItem.vue?ef0b","webpack://wavelovers/./src/components/GamepadItem.vue","webpack://wavelovers/./src/components/GamepadList.vue?8510","webpack://wavelovers/./src/components/GamepadList.vue","webpack://wavelovers/./src/components/MessageItem.vue?5b71","webpack://wavelovers/./src/components/MessageItem.vue?b787","webpack://wavelovers/./src/components/MessageItem.vue","webpack://wavelovers/./src/models/Vibrator.ts","webpack://wavelovers/./src/components/WaveloversApp.vue?23c2","webpack://wavelovers/./src/components/WaveloversApp.vue","webpack://wavelovers/./src/App.vue?847a","webpack://wavelovers/./src/App.vue","webpack://wavelovers/./src/main.ts","webpack://wavelovers/webpack/bootstrap","webpack://wavelovers/webpack/runtime/chunk loaded","webpack://wavelovers/webpack/runtime/compat get default export","webpack://wavelovers/webpack/runtime/define property getters","webpack://wavelovers/webpack/runtime/global","webpack://wavelovers/webpack/runtime/hasOwnProperty shorthand","webpack://wavelovers/webpack/runtime/jsonp chunk loading","webpack://wavelovers/webpack/startup"],"sourcesContent":["import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock } from \"vue\"\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_WaveloversApp = _resolveComponent(\"WaveloversApp\")!\n\n return (_openBlock(), _createBlock(_component_WaveloversApp))\n}","import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"wavelovers\" }\nconst _hoisted_2 = /*#__PURE__*/_createTextVNode(\"Loading...\")\nconst _hoisted_3 = /*#__PURE__*/_createTextVNode(\"Press any gamepad button or connect a new gamepad to vibrate.\")\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_PatternList = _resolveComponent(\"PatternList\")!\n const _component_MessageItem = _resolveComponent(\"MessageItem\")!\n const _component_GamepadList = _resolveComponent(\"GamepadList\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n (_ctx.patterns.length > 0)\n ? (_openBlock(), _createBlock(_component_PatternList, {\n key: 0,\n patterns: _ctx.patterns,\n mode: _ctx.mode,\n isActive: _ctx.isActive,\n onChange: _ctx.change\n }, null, 8, [\"patterns\", \"mode\", \"isActive\", \"onChange\"]))\n : (_openBlock(), _createBlock(_component_MessageItem, { key: 1 }, {\n default: _withCtx(() => [\n _hoisted_2\n ]),\n _: 1\n })),\n (_ctx.gamepads.length > 0)\n ? (_openBlock(), _createBlock(_component_GamepadList, {\n key: 2,\n gamepads: _ctx.gamepads\n }, null, 8, [\"gamepads\"]))\n : (_openBlock(), _createBlock(_component_MessageItem, { key: 3 }, {\n default: _withCtx(() => [\n _hoisted_3\n ]),\n _: 1\n }))\n ]))\n}","import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"pattern-list\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_PatternItem = _resolveComponent(\"PatternItem\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.patterns, (pattern, index) => {\n return (_openBlock(), _createBlock(_component_PatternItem, {\n key: pattern.name,\n pattern: pattern,\n index: index,\n mode: _ctx.mode,\n isActive: _ctx.isActive,\n onChange: _ctx.change\n }, null, 8, [\"pattern\", \"index\", \"mode\", \"isActive\", \"onChange\"]))\n }), 128))\n ]))\n}","import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = [\"textContent\"]\nconst _hoisted_2 = [\"textContent\"]\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", {\n onClick: _cache[0] || (_cache[0] = ($event: any) => (_ctx.change(_ctx.index))),\n class: _normalizeClass(['pattern-item',\r\n _ctx.index === _ctx.mode && _ctx.isActive === true ?\r\n 'pattern-item_selected' : '',\r\n ])\n }, [\n _createElementVNode(\"span\", {\n class: \"pattern-item__icon\",\n textContent: _toDisplayString(_ctx.pattern.icon)\n }, null, 8, _hoisted_1),\n _createElementVNode(\"span\", {\n class: \"pattern-item__name\",\n textContent: _toDisplayString(_ctx.pattern.name)\n }, null, 8, _hoisted_2)\n ], 2))\n}","\r\n import { defineComponent } from 'vue';\r\n\r\n export default defineComponent({\r\n name: 'PatternItem',\r\n props: {\r\n pattern: {\r\n type: Object,\r\n },\r\n index: {\r\n type: Number,\r\n },\r\n mode: {\r\n type: Number,\r\n },\r\n isActive: {\r\n type: Boolean,\r\n },\r\n },\r\n methods: {\r\n change(index: number): void {\r\n this.$emit('change', index as number);\r\n },\r\n },\r\n });\r\n","import { render } from \"./PatternItem.vue?vue&type=template&id=e1c2f044&ts=true\"\nimport script from \"./PatternItem.vue?vue&type=script&lang=ts\"\nexport * from \"./PatternItem.vue?vue&type=script&lang=ts\"\n\nimport \"./PatternItem.vue?vue&type=style&index=0&id=e1c2f044&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\r\n import { defineComponent } from 'vue';\r\n import PatternItem from '@/components/PatternItem.vue';\r\n\r\n export default defineComponent({\r\n name: 'PatternList',\r\n props: {\r\n patterns: {\r\n type: Array,\r\n },\r\n mode: {\r\n type: Number,\r\n },\r\n isActive: {\r\n type: Boolean,\r\n },\r\n },\r\n components: {\r\n PatternItem: PatternItem,\r\n },\r\n methods: {\r\n change(index: number): void {\r\n this.$emit('change', index as number);\r\n },\r\n },\r\n });\r\n","import { render } from \"./PatternList.vue?vue&type=template&id=77356b3f&ts=true\"\nimport script from \"./PatternList.vue?vue&type=script&lang=ts\"\nexport * from \"./PatternList.vue?vue&type=script&lang=ts\"\n\nimport \"./PatternList.vue?vue&type=style&index=0&id=77356b3f&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, toDisplayString as _toDisplayString, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"device-list\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_GamepadItem = _resolveComponent(\"GamepadItem\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.gamepads, (gamepad) => {\n return (_openBlock(), _createBlock(_component_GamepadItem, {\n key: gamepad.id,\n textContent: _toDisplayString(gamepad.unit.id)\n }, null, 8, [\"textContent\"]))\n }), 128))\n ]))\n}","import { openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"list-item\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1))\n}","\r\n import { defineComponent } from 'vue';\r\n\r\n export default defineComponent({\r\n name: 'GamepadItem',\r\n });\r\n","import { render } from \"./GamepadItem.vue?vue&type=template&id=e6e6c988&ts=true\"\nimport script from \"./GamepadItem.vue?vue&type=script&lang=ts\"\nexport * from \"./GamepadItem.vue?vue&type=script&lang=ts\"\n\nimport \"./GamepadItem.vue?vue&type=style&index=0&id=e6e6c988&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\r\n import { defineComponent } from 'vue';\r\n import GamepadItem from '@/components/GamepadItem.vue';\r\n\r\n export default defineComponent({\r\n name: 'GamepadList',\r\n props: {\r\n gamepads: {\r\n type: Array,\r\n },\r\n },\r\n components: {\r\n GamepadItem: GamepadItem,\r\n },\r\n });\r\n ","import { render } from \"./GamepadList.vue?vue&type=template&id=1d58b1c0&ts=true\"\nimport script from \"./GamepadList.vue?vue&type=script&lang=ts\"\nexport * from \"./GamepadList.vue?vue&type=script&lang=ts\"\n\nimport \"./GamepadList.vue?vue&type=style&index=0&id=1d58b1c0&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { renderSlot as _renderSlot, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"message\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createElementVNode(\"span\", null, [\n _renderSlot(_ctx.$slots, \"default\")\n ])\n ]))\n}","\r\n import { defineComponent } from 'vue';\r\n\r\n export default defineComponent({\r\n name: 'MessageItem',\r\n });\r\n","import { render } from \"./MessageItem.vue?vue&type=template&id=32e2819b&ts=true\"\nimport script from \"./MessageItem.vue?vue&type=script&lang=ts\"\nexport * from \"./MessageItem.vue?vue&type=script&lang=ts\"\n\nimport \"./MessageItem.vue?vue&type=style&index=0&id=32e2819b&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import TPatternUnit from '@/models/TPatternUnit';\r\nimport IGamepad from '@/models/IGamepad';\r\nimport IVibrator from '@/models/IVibrator';\r\n\r\nclass Vibrator implements IVibrator {\r\n readonly id: number;\r\n readonly canVibrate: boolean;\r\n isVibrating: boolean;\r\n unit: IGamepad;\r\n pattern: TPatternUnit[];\r\n\r\n constructor(unit: IGamepad) {\r\n this.unit = unit;\r\n this.id = Date.now();\r\n this.canVibrate = (this.unit.vibrationActuator) ? true : false;\r\n this.isVibrating = false;\r\n this.pattern = [];\r\n }\r\n\r\n update(): void {\r\n const gamepads = navigator.getGamepads();\r\n this.unit = gamepads[this.unit.index];\r\n }\r\n\r\n reset(): void {\r\n this.isVibrating = false;\r\n this.unit.vibrationActuator.reset();\r\n }\r\n\r\n async vibrate(pattern: TPatternUnit[]) {\r\n this.isVibrating = true;\r\n this.pattern = pattern;\r\n\r\n while (this.isVibrating === true) {\r\n for (let i = 0; i < this.pattern.length; i++) {\r\n if (this.isVibrating === true) {\r\n this.unit.vibrationActuator.playEffect('dual-rumble', this.pattern[i]);\r\n await this.sleep(this.pattern[i].startDelay + this.pattern[i].duration);\r\n } else {\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n\r\n sleep(ms: number): Promise {\r\n return new Promise(resolve => setTimeout(resolve, ms));\r\n }\r\n}\r\n\r\nexport default Vibrator;\r\n\r\n","\r\n import { defineComponent } from 'vue';\r\n import PatternList from '@/components/PatternList.vue';\r\n import GamepadList from '@/components/GamepadList.vue';\r\n import MessageItem from '@/components/MessageItem.vue';\r\n import IGamepadEvent from '@/models/IGamepadEvent';\r\n import IGamepad from '@/models/IGamepad';\r\n import TPattern from '@/models/TPattern';\r\n import TPatternUnit from '@/models/TPatternUnit';\r\n import Vibrator from '@/models/Vibrator';\r\n \r\n export default defineComponent({\r\n name: 'WaveloversApp',\r\n components: {\r\n PatternList: PatternList,\r\n GamepadList: GamepadList,\r\n MessageItem: MessageItem,\r\n },\r\n data: () => {\r\n return {\r\n gamepads: [] as Vibrator[],\r\n patterns: [] as TPattern[],\r\n isActive: false,\r\n mode: 0,\r\n };\r\n },\r\n methods: {\r\n loadPatterns: async function () {\r\n const url = 'https://wavelovers.ru/assets/patterns.json';\r\n try {\r\n const response = await fetch(url);\r\n if (response.ok) {\r\n let json = await response.json();\r\n this.patterns = json;\r\n } else {\r\n console.log('Connect to the Internet for download more patterns...');\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n },\r\n addEventListeners(): void {\r\n window.addEventListener('gamepadconnected', (event: GamepadEvent) => this.addGamepad(event));\r\n window.addEventListener('gamepaddisconnected', (event: GamepadEvent) => this.deleteGamepad(event));\r\n },\r\n addGamepad(event: GamepadEvent) {\r\n const ievent: IGamepadEvent = event as unknown as IGamepadEvent;\r\n if (this.gamepads.length >= 1) {\r\n return;\r\n } else {\r\n this.gamepads.push(new Vibrator(ievent.gamepad as IGamepad));\r\n }\r\n },\r\n deleteGamepad(event: GamepadEvent): void {\r\n this.gamepads.forEach((gamepad, index) => {\r\n if (gamepad.unit.id === event.gamepad.id) {\r\n this.gamepads.splice(index, 1);\r\n }\r\n });\r\n },\r\n change(index: number): void {\r\n if (this.mode === index) {\r\n this.isActive = !this.isActive;\r\n this.reset();\r\n } else {\r\n this.isActive = true;\r\n this.mode = index;\r\n }\r\n if (this.isActive === true) {\r\n this.reset();\r\n this.vibrate();\r\n }\r\n },\r\n vibrate(): void {\r\n this.gamepads.forEach(gamepad => {\r\n gamepad.vibrate(this.patterns[this.mode].pattern as TPatternUnit[]);\r\n });\r\n },\r\n reset(): void {\r\n this.gamepads.forEach(gamepad => {\r\n gamepad.reset();\r\n });\r\n },\r\n },\r\n mounted() {\r\n this.loadPatterns();\r\n this.addEventListeners();\r\n },\r\n });\r\n","import { render } from \"./WaveloversApp.vue?vue&type=template&id=667d8d41&ts=true\"\nimport script from \"./WaveloversApp.vue?vue&type=script&lang=ts\"\nexport * from \"./WaveloversApp.vue?vue&type=script&lang=ts\"\n\nimport \"./WaveloversApp.vue?vue&type=style&index=0&id=667d8d41&lang=scss\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\n import { defineComponent } from 'vue';\n import WaveloversApp from '@/components/WaveloversApp.vue';\n\n export default defineComponent({\n name: 'App',\n components: {\n WaveloversApp: WaveloversApp,\n },\n });\n","import { render } from \"./App.vue?vue&type=template&id=4be8096e&ts=true\"\nimport script from \"./App.vue?vue&type=script&lang=ts\"\nexport * from \"./App.vue?vue&type=script&lang=ts\"\n\nimport exportComponent from \"E:\\\\Sources\\\\Repos\\\\wavelovers\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createApp } from 'vue';\nimport App from './App.vue';\n\ncreateApp(App).mount('#app');\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t143: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; };\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkwavelovers\"] = self[\"webpackChunkwavelovers\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [998], function() { return __webpack_require__(1675); })\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["render","_ctx","_cache","$props","$setup","$data","$options","_component_WaveloversApp","_resolveComponent","_openBlock","_createBlock","_hoisted_1","class","_hoisted_2","_createTextVNode","_hoisted_3","_component_PatternList","_component_MessageItem","_component_GamepadList","_createElementBlock","patterns","length","key","mode","isActive","onChange","change","default","_withCtx","_","gamepads","_component_PatternItem","_Fragment","_renderList","pattern","index","name","onClick","$event","_normalizeClass","_createElementVNode","textContent","_toDisplayString","icon","defineComponent","props","type","Object","Number","Boolean","methods","this","$emit","__exports__","Array","components","PatternItem","_component_GamepadItem","gamepad","id","unit","GamepadItem","_renderSlot","$slots","Vibrator","constructor","Date","now","canVibrate","vibrationActuator","isVibrating","update","navigator","getGamepads","reset","i","playEffect","sleep","startDelay","duration","ms","Promise","resolve","setTimeout","PatternList","GamepadList","MessageItem","data","loadPatterns","async","url","response","fetch","ok","json","console","log","error","addEventListeners","window","addEventListener","event","addGamepad","deleteGamepad","ievent","push","forEach","splice","vibrate","mounted","WaveloversApp","createApp","App","mount","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","m","deferred","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","r","n","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","g","globalThis","Function","e","obj","prop","prototype","hasOwnProperty","call","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","chunkLoadingGlobal","self","bind","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/WaveloversApp.vue b/src/components/WaveloversApp.vue index ec997e4..a80979a 100644 --- a/src/components/WaveloversApp.vue +++ b/src/components/WaveloversApp.vue @@ -75,7 +75,6 @@ change(index: number): void { if (this.mode === index) { this.isActive = !this.isActive; - this.reset(); } else { this.isActive = true; this.mode = index; @@ -83,6 +82,8 @@ if (this.isActive === true) { this.reset(); this.vibrate(); + } else { + this.reset(); } }, vibrate(): void {