-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Remove support for the scope
parameter in the MessageHandler.on
method
#11110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove support for the scope
parameter in the MessageHandler.on
method
#11110
Conversation
…ethod At this point in time it's easy to convert the `MessageHandler.on` call-sites to use arrow functions, and thus let the JavaScript engine handle scopes for us, rather than having to manually keep references to the relevant scopes in `MessageHandler`.[1] An additional benefit of this is that a couple of `Function.prototype.call()` instances can now be converted into "normal" function calls, which should be a tiny bit more efficient. All in all, I don't see any compelling reason why it'd be necessary to keep supporting custom `scope`s in the `MessageHandler` implementation. --- [1] In the event that a custom scope is ever needed, simply using `bind` on the handler function when calling `MessageHandler.on` ought to work as well.
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/574aa29f2d1fabb/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/41914fd4e4f27b1/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/574aa29f2d1fabb/output.txt Total script time: 2.60 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/41914fd4e4f27b1/output.txt Total script time: 5.07 mins
|
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/fccbeeea173f32d/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/94854afad9ab05d/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/94854afad9ab05d/output.txt Total script time: 2.58 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/fccbeeea173f32d/output.txt Total script time: 5.01 mins
|
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/9d88873832d30ff/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/473a5d70aa0ddc2/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/9d88873832d30ff/output.txt Total script time: 17.65 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/473a5d70aa0ddc2/output.txt Total script time: 25.90 mins
|
/botio unittest |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/b73d712774847f3/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/e83bce01bf15cab/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/e83bce01bf15cab/output.txt Total script time: 2.59 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/b73d712774847f3/output.txt Total script time: 5.03 mins
|
Nice find! Thank you for simplifying this. |
At this point in time it's easy to convert the
MessageHandler.on
call-sites to use arrow functions, and thus let the JavaScript engine handle scopes for us, rather than having to manually keep references to the relevant scopes inMessageHandler
.[1]An additional benefit of this is that a couple of
Function.prototype.call()
instances can now be converted into "normal" function calls, which should be a tiny bit more efficient.All in all, I don't see any compelling reason why it'd be necessary to keep supporting custom
scope
s in theMessageHandler
implementation.[1] In the event that a custom scope is ever needed, simply using
bind
on the handler function when callingMessageHandler.on
ought to work as well.