aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-11-05 20:49:37 +1100
committerSam Potts <me@sampotts.me>2017-11-05 20:49:37 +1100
commit6bebbe41530873e40b3615acb33e2f1fd55fb342 (patch)
tree7ff1ba65cda4bc154e9b1002122d4bb6d6da3803 /src/js
parent374de800a4d092a5636466aa4cec4f1c5eb3a0c6 (diff)
downloadplyr-6bebbe41530873e40b3615acb33e2f1fd55fb342.tar.lz
plyr-6bebbe41530873e40b3615acb33e2f1fd55fb342.tar.xz
plyr-6bebbe41530873e40b3615acb33e2f1fd55fb342.zip
Key listeners fix
Diffstat (limited to 'src/js')
-rw-r--r--src/js/listeners.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/js/listeners.js b/src/js/listeners.js
index 44817b46..350137c1 100644
--- a/src/js/listeners.js
+++ b/src/js/listeners.js
@@ -151,11 +151,9 @@ const listeners = {
};
// Get the key code for an event
- function getKeyCode(event) {
- return event.keyCode ? event.keyCode : event.which;
- }
+ const getKeyCode = event => (event.keyCode ? event.keyCode : event.which);
- function handleKey(event) {
+ const handleKey = event => {
const code = getKeyCode(event);
const pressed = event.type === 'keydown';
const held = pressed && code === last;
@@ -167,10 +165,10 @@ const listeners = {
}
// Seek by the number keys
- function seekByKey() {
+ const seekByKey = () => {
// Divide the max duration into 10th's and times by the number value
this.currentTime = this.duration / 10 * (code - 48);
- }
+ };
// Handle the key on keydown
// Reset on keyup
@@ -306,7 +304,7 @@ const listeners = {
} else {
last = null;
}
- }
+ };
// Keyboard shortcuts
if (this.config.keyboard.focused) {