You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's being used in a for-loop to declare a listener that """kills""" (this is a bad name choice too, just for the record) the server if any of the declared "exit events" occurred.
While I'm pretty okay with exitEvents, I still have to complain and would like to suggest something better. "exit events" could mean anything. For example if the server happens to decode something invalid and crashes... that could be considered an exit event. But an exit event isn't the same as an interrupt signal. Therefore I'd like to suggest to you to change the variable name to interruptSignals and the for-loop to for (let interruptSignal of interruptSignals).
process.on(interruptSignal, ...) reads alot better than process.on(event, ...) because interrupt signals are closely related to processes and will be understood in an instant.
I was having a look at the source and noticed this ambiguous named local variable. It's
exitEvents
at line 22.JSPrismarine/src/Server.ts
Line 22 in 7172e2c
It's being used in a for-loop to declare a listener that """kills""" (this is a bad name choice too, just for the record) the server if any of the declared "exit events" occurred.
JSPrismarine/src/Server.ts
Lines 22 to 27 in 7172e2c
While I'm pretty okay with
exitEvents
, I still have to complain and would like to suggest something better. "exit events" could mean anything. For example if the server happens to decode something invalid and crashes... that could be considered an exit event. But an exit event isn't the same as an interrupt signal. Therefore I'd like to suggest to you to change the variable name tointerruptSignals
and the for-loop tofor (let interruptSignal of interruptSignals)
.process.on(interruptSignal, ...)
reads alot better thanprocess.on(event, ...)
because interrupt signals are closely related to processes and will be understood in an instant.Here are the changes for copy-paste:
Also, optionally, you could inline the array in the for-loop:
The text was updated successfully, but these errors were encountered: