From a2c20a9aa7d72033c472c56767587548bcad53c9 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Tue, 5 Jun 2018 01:08:32 +0100 Subject: [PATCH] lint fixes --- CHANGELOG.md | 2 ++ src/data/DataManager.js | 40 +++++++++++++++++---------------------- src/input/InputManager.js | 3 ++- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8edc3bce..f6eb915c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Input System New Features + Updates +TODO - Out of Canvas events + * All Input classes are now covered 100% by JSDocs. * The Input Manager and Input Plugin have been updated to support multiple simultaneous Pointers. Before, only one active pointer (mouse or touch) was supported. Now, you can have as many active pointers as you need, allowing for complex multi-touch games. These are stored in the Input Manager `pointers` array. * `addPointer` allows you to add one, or more, new pointers to the Input Manager. There is no hard-coded limit to the amount you can have, although realistically you should never need more than 10. This method is available on both the Input Manager and Plugin, allowing you to use `this.input.addPointer` from within your game code. diff --git a/src/data/DataManager.js b/src/data/DataManager.js index 956e6bf89..6253a57c9 100644 --- a/src/data/DataManager.js +++ b/src/data/DataManager.js @@ -143,11 +143,7 @@ var DataManager = new Class({ { var list = this.list; - if (typeof key === 'string') - { - return list[key]; - } - else + if (Array.isArray(key)) { var output = []; @@ -158,6 +154,10 @@ var DataManager = new Class({ return output; } + else + { + return list[key]; + } }, /** @@ -263,11 +263,9 @@ var DataManager = new Class({ } else { - var config = key; - - for (var key in config) + for (var entry in key) { - this.setValue(key, config[key]); + this.setValue(entry, key[entry]); } } @@ -309,14 +307,13 @@ var DataManager = new Class({ enumerable: true, - get: function () { - + get: function () + { return list[key]; - }, - set: function (value) { - + set: function (value) + { if (!_this._frozen) { list[key] = value; @@ -324,7 +321,6 @@ var DataManager = new Class({ events.emit('changedata', parent, key, data); events.emit('changedata_' + key, parent, data); } - } }); @@ -363,7 +359,7 @@ var DataManager = new Class({ args[1] = key; args[2] = this.list[key]; - callback.apply(scope, args); + callback.apply(context, args); } return this; @@ -425,19 +421,17 @@ var DataManager = new Class({ return this; } - var list = this.list; - - if (typeof key === 'string') - { - return this.removeValue(key); - } - else + if (Array.isArray(key)) { for (var i = 0; i < key.length; i++) { this.removeValue(key[i]); } } + else + { + return this.removeValue(key); + } return this; }, diff --git a/src/input/InputManager.js b/src/input/InputManager.js index 707310894..6bae6959e 100644 --- a/src/input/InputManager.js +++ b/src/input/InputManager.js @@ -942,7 +942,8 @@ var InputManager = new Class({ if (parent) { - do { + do + { if (!parent.visible) { visible = false;