UNPKG

529 BJavaScriptView Raw
1"use strict";
2
3// Copyright 2017-2018 Jaco Greeff
4// This software may be modified and distributed under the terms
5// of the ISC license. See the LICENSE file for details.
6module.exports = function onClose(self) {
7 return () => {
8 self.l.debug(() => ['disconnected from', self.endpoint]);
9 self.isConnected = false;
10 self.emitter.emit('disconnected');
11
12 if (self.autoConnect) {
13 setTimeout(() => {
14 // FIXME: This is a circular dependency
15 require('./connect')(self);
16 }, 1000);
17 }
18 };
19};
\No newline at end of file