diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-25 14:19:18 -0500 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-26 22:06:27 -0500 | 
| commit | 0aed27b66d9c496e4cd57ef95d982c4e634a8666 (patch) | |
| tree | e73353f53b028c211fe38043bd12a3a520daa9c1 /ext/fg/js | |
| parent | 663667306ce7ddcfeb603191dcd4a0f133f08b37 (diff) | |
Replace hasOwnProperty with simplified hasOwn function
Diffstat (limited to 'ext/fg/js')
| -rw-r--r-- | ext/fg/js/float.js | 4 | ||||
| -rw-r--r-- | ext/fg/js/frontend-api-receiver.js | 2 | ||||
| -rw-r--r-- | ext/fg/js/frontend-api-sender.js | 6 | ||||
| -rw-r--r-- | ext/fg/js/frontend.js | 4 | ||||
| -rw-r--r-- | ext/fg/js/popup-proxy-host.js | 4 | 
5 files changed, 10 insertions, 10 deletions
| diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index 089c9422..ae54be00 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -49,7 +49,7 @@ class DisplayFloat extends Display {      onMessage(e) {          const {action, params} = e.data;          const handlers = DisplayFloat.messageHandlers; -        if (handlers.hasOwnProperty(action)) { +        if (hasOwn(handlers, action)) {              const handler = handlers[action];              handler(this, params);          } @@ -58,7 +58,7 @@ class DisplayFloat extends Display {      onKeyDown(e) {          const key = Display.getKeyFromEvent(e);          const handlers = DisplayFloat.onKeyDownHandlers; -        if (handlers.hasOwnProperty(key)) { +        if (hasOwn(handlers, key)) {              const handler = handlers[key];              if (handler(this, e)) {                  e.preventDefault(); diff --git a/ext/fg/js/frontend-api-receiver.js b/ext/fg/js/frontend-api-receiver.js index fbfb3ab0..bde14646 100644 --- a/ext/fg/js/frontend-api-receiver.js +++ b/ext/fg/js/frontend-api-receiver.js @@ -34,7 +34,7 @@ class FrontendApiReceiver {      onMessage(port, {id, action, params, target, senderId}) {          if (              target !== this.source || -            !this.handlers.hasOwnProperty(action) +            !hasOwn(this.handlers, action)          ) {              return;          } diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js index c6eeaeb2..af998a8f 100644 --- a/ext/fg/js/frontend-api-sender.js +++ b/ext/fg/js/frontend-api-sender.js @@ -78,7 +78,7 @@ class FrontendApiSender {      }      onAck(id) { -        if (!this.callbacks.hasOwnProperty(id)) { +        if (!hasOwn(this.callbacks, id)) {              console.warn(`ID ${id} not found for ack`);              return;          } @@ -95,7 +95,7 @@ class FrontendApiSender {      }      onResult(id, data) { -        if (!this.callbacks.hasOwnProperty(id)) { +        if (!hasOwn(this.callbacks, id)) {              console.warn(`ID ${id} not found`);              return;          } @@ -118,7 +118,7 @@ class FrontendApiSender {      }      onError(id, reason) { -        if (!this.callbacks.hasOwnProperty(id)) { return; } +        if (!hasOwn(this.callbacks, id)) { return; }          const info = this.callbacks[id];          delete this.callbacks[id];          info.timer = null; diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index ee653d78..16302e82 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -237,7 +237,7 @@ class Frontend {      onWindowMessage(e) {          const action = e.data;          const handlers = Frontend.windowMessageHandlers; -        if (handlers.hasOwnProperty(action)) { +        if (hasOwn(handlers, action)) {              const handler = handlers[action];              handler(this);          } @@ -245,7 +245,7 @@ class Frontend {      onRuntimeMessage({action, params}, sender, callback) {          const handlers = Frontend.runtimeMessageHandlers; -        if (handlers.hasOwnProperty(action)) { +        if (hasOwn(handlers, action)) {              const handler = handlers[action];              const result = handler(this, params);              callback(result); diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index d8dec4df..b2f18b97 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -50,7 +50,7 @@ class PopupProxyHost {      }      createPopup(parentId, depth) { -        const parent = (typeof parentId === 'string' && this.popups.hasOwnProperty(parentId) ? this.popups[parentId] : null); +        const parent = (typeof parentId === 'string' && hasOwn(this.popups, parentId) ? this.popups[parentId] : null);          const id = `${this.nextId}`;          if (parent !== null) {              depth = parent.depth + 1; @@ -70,7 +70,7 @@ class PopupProxyHost {      }      getPopup(id) { -        if (!this.popups.hasOwnProperty(id)) { +        if (!hasOwn(this.popups, id)) {              throw new Error('Invalid popup ID');          } |