[gjs: 2/3] signals: Fix eslint formatting, make for loop more compact in _signalHandlerIsConnected
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/3] signals: Fix eslint formatting, make for loop more compact in _signalHandlerIsConnected
- Date: Wed, 14 Nov 2018 16:10:03 +0000 (UTC)
commit a727a25799ffba068d9df67559d327fec1bf305d
Author: Jason Hicks <jaszhix gmail com>
Date: Wed Nov 14 06:08:00 2018 -0600
signals: Fix eslint formatting, make for loop more compact in _signalHandlerIsConnected
modules/signals.js | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/modules/signals.js b/modules/signals.js
index d08c7fd1..61dbd93c 100644
--- a/modules/signals.js
+++ b/modules/signals.js
@@ -82,16 +82,11 @@ function _signalHandlerIsConnected(id) {
if (!('_signalConnections' in this))
return false;
- let i;
- let length = this._signalConnections.length;
- for (i = 0; i < length; ++i) {
- let connection = this._signalConnections[i];
- if (connection.id == id) {
- if (connection.disconnected) {
- return false;
- }
- return true;
- }
+ const {length} = this._signalConnections;
+ for (let i = 0; i < length; ++i) {
+ const connection = this._signalConnections[i];
+ if (connection.id === id)
+ return !connection.disconnected;
}
return false;
@@ -173,7 +168,7 @@ function addSignalMethods(proto) {
_addSignalMethod(proto, "connect", _connect);
_addSignalMethod(proto, "disconnect", _disconnect);
_addSignalMethod(proto, "emit", _emit);
- _addSignalMethod(proto, 'signalHandlerIsConnected', _signalHandlerIsConnected)
+ _addSignalMethod(proto, 'signalHandlerIsConnected', _signalHandlerIsConnected);
// this one is not in GObject, but useful
_addSignalMethod(proto, "disconnectAll", _disconnectAll);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]