dist/monitor-all.js
function(monitor, reason, callback) {
      callback = callback || function(){};
      var t = this, probe = monitor.probe, probeId = monitor.get('probeId');

      // The monitor must be connected
      if (!probe) {return callback('Monitor must be connected');}

      // Called upon disconnect (internal or external)
      var onDisconnect = function(error) {
        if (error) {
          return callback(error);
        }
        probe.off('change', monitor.probeChange);
        monitor.set({probeId:null});
        monitor.probe = monitor.probeChange = null;
        return callback(null, reason);
      };

      // Disconnect from an internal or external probe
      if (probe.connection) {
        t.disconnectExternal(probe.connection, probeId, onDisconnect);
      } else {
        t.disconnectInternal(probeId, onDisconnect);
      }
    }
function(monitor, reason, callback) {
      callback = callback || function(){};
      var t = this, probe = monitor.probe, probeId = monitor.get('probeId');

      // The monitor must be connected
      if (!probe) {return callback('Monitor must be connected');}

      // Called upon disconnect (internal or external)
      var onDisconnect = function(error) {
        if (error) {
          return callback(error);
        }
        probe.off('change', monitor.probeChange);
        monitor.set({probeId:null});
        monitor.probe = monitor.probeChange = null;
        return callback(null, reason);
      };

      // Disconnect from an internal or external probe
      if (probe.connection) {
        t.disconnectExternal(probe.connection, probeId, onDisconnect);
      } else {
        t.disconnectInternal(probeId, onDisconnect);
      }
    }
function ( monitor , reason , callback ) { callback = callback || function ( ) { } ; var t = this , probe = monitor . probe , probeId = monitor . get ( 'probeId' ) ; // The monitor must be connected if ( ! probe ) { return callback ( 'Monitor must be connected' ) ; } // Called upon disconnect (internal or external) var onDisconnect = function ( error ) { if ( error ) { return callback ( error ) ; } probe . off ( 'change' , monitor . probeChange ) ; monitor . set ( { probeId : null } ) ; monitor . probe = monitor . probeChange = null ; return callback ( null , reason ) ; } ; // Disconnect from an internal or external probe if ( probe . connection ) { t . disconnectExternal ( probe . connection , probeId , onDisconnect ) ; } else { t . disconnectInternal ( probeId , onDisconnect ) ; } }
Disconnect a monitor

This accepts an instance of a connected monitor, and disconnects it from
the remote probe.

The probe implementation will be released if this is the only monitor
object watching it.

@method disconnectMonitor
@protected
@param monitor {Monitor} - The connected monitor
@param reason {String} - Reason for the disconnect
@param callback {Function(error)} - (optional) Called when connected
Disconnect a monitor