unregister event disconnect

https://github.com/ntoff/OctoPrint-Estop/issues/4#issuecomment-371146397
This commit is contained in:
ntoff 2018-03-08 10:45:58 +10:00
parent 62a6dac6e9
commit 15889e0dc7

View File

@ -54,8 +54,9 @@ $(function() {
if (self.estopReconnect()) { //cycle the connection (if enabled) to reset the control board if (self.estopReconnect()) { //cycle the connection (if enabled) to reset the control board
OctoPrint.connection.disconnect(); //send a disconnect, maybe useful for breaking out of blocking commands. OctoPrint.connection.disconnect(); //send a disconnect, maybe useful for breaking out of blocking commands.
self.onEventDisconnected =function () { //wait until octoprint has disconnected self.onEventDisconnected = function () { //wait until octoprint has disconnected
OctoPrint.connection.connect(); //reconnect self.onEventDisconnected = null; //unregister event handler
OctoPrint.connection.connect(); //reconnect
} }
} }
}; };