src/LiveDevelopment/Inspector/Inspector.js
function disconnect() {
        var deferred = new $.Deferred(),
            promise = deferred.promise();

        if (_socket && (_socket.readyState === WebSocket.OPEN)) {
            _socket.onclose = function () {
                // trigger disconnect event
                _onDisconnect();

                deferred.resolve();
            };

            promise = Async.withTimeout(promise, 5000);

            _socket.close();
        } else {
            if (_socket) {
                delete _socket.onmessage;
                delete _socket.onopen;
                delete _socket.onclose;
                delete _socket.onerror;

                _socket = undefined;
            }

            deferred.resolve();
        }

        return promise;
    }
function disconnect() {
        var deferred = new $.Deferred(),
            promise = deferred.promise();

        if (_socket && (_socket.readyState === WebSocket.OPEN)) {
            _socket.onclose = function () {
                // trigger disconnect event
                _onDisconnect();

                deferred.resolve();
            };

            promise = Async.withTimeout(promise, 5000);

            _socket.close();
        } else {
            if (_socket) {
                delete _socket.onmessage;
                delete _socket.onopen;
                delete _socket.onclose;
                delete _socket.onerror;

                _socket = undefined;
            }

            deferred.resolve();
        }

        return promise;
    }
function disconnect ( ) { var deferred = new $ . Deferred ( ) , promise = deferred . promise ( ) ; if ( _socket && ( _socket . readyState === WebSocket . OPEN ) ) { _socket . onclose = function ( ) { // trigger disconnect event _onDisconnect ( ) ; deferred . resolve ( ) ; } ; promise = Async . withTimeout ( promise , 5000 ) ; _socket . close ( ) ; } else { if ( _socket ) { delete _socket . onmessage ; delete _socket . onopen ; delete _socket . onclose ; delete _socket . onerror ; _socket = undefined ; } deferred . resolve ( ) ; } return promise ; }
Disconnect from the remote debugger WebSocket
@return {jQuery.Promise} Promise that is resolved immediately if not
currently connected or asynchronously when the socket is closed.
Disconnect from the remote debugger WebSocket