js/leaflet.markercluster.js
function (layer, callback) {

    var showMarker = function () {
      if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) {
        this._map.off('moveend', showMarker, this);
        this.off('animationend', showMarker, this);

        if (layer._icon) {
          callback();
        } else if (layer.__parent._icon) {
          var afterSpiderfy = function () {
            this.off('spiderfied', afterSpiderfy, this);
            callback();
          };

          this.on('spiderfied', afterSpiderfy, this);
          layer.__parent.spiderfy();
        }
      }
    };

    if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
      //Layer is visible ond on screen, immediate return
      callback();
    } else if (layer.__parent._zoom < this._map.getZoom()) {
      //Layer should be visible at this zoom level. It must not be on screen so just pan over to it
      this._map.on('moveend', showMarker, this);
      this._map.panTo(layer.getLatLng());
    } else {
      var moveStart = function () {
        this._map.off('movestart', moveStart, this);
        moveStart = null;
      };

      this._map.on('movestart', moveStart, this);
      this._map.on('moveend', showMarker, this);
      this.on('animationend', showMarker, this);
      layer.__parent.zoomToBounds();

      if (moveStart) {
        //Never started moving, must already be there, probably need clustering however
        showMarker.call(this);
      }
    }
  }
function (layer, callback) {

    var showMarker = function () {
      if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) {
        this._map.off('moveend', showMarker, this);
        this.off('animationend', showMarker, this);

        if (layer._icon) {
          callback();
        } else if (layer.__parent._icon) {
          var afterSpiderfy = function () {
            this.off('spiderfied', afterSpiderfy, this);
            callback();
          };

          this.on('spiderfied', afterSpiderfy, this);
          layer.__parent.spiderfy();
        }
      }
    };

    if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
      //Layer is visible ond on screen, immediate return
      callback();
    } else if (layer.__parent._zoom < this._map.getZoom()) {
      //Layer should be visible at this zoom level. It must not be on screen so just pan over to it
      this._map.on('moveend', showMarker, this);
      this._map.panTo(layer.getLatLng());
    } else {
      var moveStart = function () {
        this._map.off('movestart', moveStart, this);
        moveStart = null;
      };

      this._map.on('movestart', moveStart, this);
      this._map.on('moveend', showMarker, this);
      this.on('animationend', showMarker, this);
      layer.__parent.zoomToBounds();

      if (moveStart) {
        //Never started moving, must already be there, probably need clustering however
        showMarker.call(this);
      }
    }
  }
function ( layer , callback ) { var showMarker = function ( ) { if ( ( layer . _icon || layer . __parent . _icon ) && ! this . _inZoomAnimation ) { this . _map . off ( 'moveend' , showMarker , this ) ; this . off ( 'animationend' , showMarker , this ) ; if ( layer . _icon ) { callback ( ) ; } else if ( layer . __parent . _icon ) { var afterSpiderfy = function ( ) { this . off ( 'spiderfied' , afterSpiderfy , this ) ; callback ( ) ; } ; this . on ( 'spiderfied' , afterSpiderfy , this ) ; layer . __parent . spiderfy ( ) ; } } } ; if ( layer . _icon && this . _map . getBounds ( ) . contains ( layer . getLatLng ( ) ) ) { //Layer is visible ond on screen, immediate return callback ( ) ; } else if ( layer . __parent . _zoom < this . _map . getZoom ( ) ) { //Layer should be visible at this zoom level. It must not be on screen so just pan over to it this . _map . on ( 'moveend' , showMarker , this ) ; this . _map . panTo ( layer . getLatLng ( ) ) ; } else { var moveStart = function ( ) { this . _map . off ( 'movestart' , moveStart , this ) ; moveStart = null ; } ; this . _map . on ( 'movestart' , moveStart , this ) ; this . _map . on ( 'moveend' , showMarker , this ) ; this . on ( 'animationend' , showMarker , this ) ; layer . __parent . zoomToBounds ( ) ; if ( moveStart ) { //Never started moving, must already be there, probably need clustering however showMarker . call ( this ) ; } } }
Zoom down to show the given layer (spiderfying if necessary) then calls the callback
Zoom down to show the given layer ( spiderfying if necessary ) then calls the callback