From 007c11f04a256a2e8704a9b26320e5c0e3457994 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 26 Oct 2023 21:04:02 +0200 Subject: treewide: use fat arrow syntax --- beamer/viewer/stage/actions.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'beamer/viewer/stage/actions.js') diff --git a/beamer/viewer/stage/actions.js b/beamer/viewer/stage/actions.js index 30634ae..47eda60 100644 --- a/beamer/viewer/stage/actions.js +++ b/beamer/viewer/stage/actions.js @@ -1,6 +1,6 @@ /* * Beamer Viewer, a web-based PDF presentation viewer - * Copyright (C) 2018 Pacien TRAN-GIRARD + * Copyright (C) 2018-2023 Pacien TRAN-GIRARD * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -27,10 +27,7 @@ class ActionEventHandler { class KeyboardEventHandler extends ActionEventHandler { register(window) { - const self = this; - window.addEventListener("keydown", function(event) { - self._onCommand(event); - }) + window.addEventListener("keydown", event => this._onCommand(event)); } _onCommand(keyboardEvent) { @@ -52,10 +49,7 @@ class KeyboardEventHandler extends ActionEventHandler { class MouseClickEventHandler extends ActionEventHandler { register(window) { - const self = this; - window.addEventListener("click", function(event) { - self._onCommand(event); - }) + window.addEventListener("click", event => this._onCommand(event)); } _onCommand(mouseEvent) { @@ -71,24 +65,22 @@ class TouchSwipeEventHandler extends ActionEventHandler { } register(window) { - const self = this; - - window.addEventListener("touchstart", function(event) { + window.addEventListener("touchstart", event => { event.preventDefault(); - self._onTouchStart(event); + this._onTouchStart(event); }); - window.addEventListener("touchmove", function(event) { + window.addEventListener("touchmove", event => { event.preventDefault(); - self._onTouchMove(event); + this._onTouchMove(event); }); - window.addEventListener("touchend", function(event) { + window.addEventListener("touchend", event => { event.preventDefault(); - self._onTouchEnd(); + this._onTouchEnd(); }); - window.addEventListener("touchcancel", function(event) { + window.addEventListener("touchcancel", event => { event.preventDefault(); }); } -- cgit v1.2.3