code: function( type, object ) {
  		if ( typeof type !== "string" ) {
  			object = type;
  			type = undefined;
  		}
  		type = type || "fx";
  		var defer = jQuery.Deferred(),
  			elements = this,
  			i = elements.length,
  			count = 1,
  			deferDataKey = type + "defer",
  			queueDataKey = type + "queue",
  			markDataKey = type + "mark",
  			tmp;
  		function resolve() {
  			if ( !( --count ) ) {
  				defer.resolveWith( elements, [ elements ] );
  			}
  		}
  		while( i-- ) {
  			if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
  					( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
  						jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
  					jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
  				count++;
  				tmp.add( resolve );
  			}
  		}
  		resolve();
  		return defer.promise();
  	}
docs: Get a promise resolved when queues of a certain type are emptied (fx is the type by default)