From a66df1331ac4c6bd37a97b6d706840fb1ec9bccd Mon Sep 17 00:00:00 2001 From: Eugene Serb <46799701+eugene-serb@users.noreply.github.com> Date: Sat, 27 Aug 2022 18:53:51 +0300 Subject: [PATCH] - fixed adding and removing event listeners. - updated version. - updated packages. - rebuild. --- package-lock.json | 4 ++-- package.json | 4 ++-- src/App.vue | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9b3f8a4..b52e593 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wavelovers", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "wavelovers", - "version": "1.0.1", + "version": "1.0.2", "license": "GNU GPL v3", "dependencies": { "core-js": "^3.8.3", diff --git a/package.json b/package.json index bbb4273..c078b7a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "wavelovers", "description": "Wavelovers. Use your device vibration correctly. Make a massager out of a gamepad.", "keywords": [ "wavelovers", "gamepad-vibrator", "gamepad-test-tool", "gamepad-vibration-test-tool" ], - "version": "1.0.1", + "version": "1.0.2", "license": "GNU GPL v3", "homepage": "https://wavelovers.ru/", "author": { @@ -15,7 +15,7 @@ "url": "https://github.com/eugene-serb/wavelovers/" }, "bugs": { - "url": "https://github.com/eugene-serb/wavelovers/issues" + "url": "https://github.com/eugene-serb/wavelovers/issues/" }, "private": true, "scripts": { diff --git a/src/App.vue b/src/App.vue index 3803887..d3ad788 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,13 +21,19 @@ FooterItem: FooterItem, }, methods: { - addEventListeners(): void { - window.addEventListener('gamepadconnected', (event: GamepadEvent) => store.dispatch('addGamepad', event)); - window.addEventListener('gamepaddisconnected', (event: GamepadEvent) => store.dispatch('deleteGamepad', event)); + addGamepad: function (event: GamepadEvent): void { + store.dispatch('addGamepad', event); }, - removeEventListeners(): void { - window.removeEventListener('gamepadconnected', (event: GamepadEvent) => store.dispatch('addGamepad', event)); - window.removeEventListener('gamepaddisconnected', (event: GamepadEvent) => store.dispatch('deleteGamepad', event)); + deleteGamepad: function (event: GamepadEvent): void { + store.dispatch('deleteGamepad', event); + }, + addEventListeners: function (): void { + window.addEventListener('gamepadconnected', this.addGamepad); + window.addEventListener('gamepaddisconnected', this.deleteGamepad); + }, + removeEventListeners: function (): void { + window.removeEventListener('gamepadconnected', this.addGamepad); + window.removeEventListener('gamepaddisconnected', this.deleteGamepad); }, }, mounted() {