composer.js
function(cb){
			if (!fnRetrieveMessages)
				return cb();
			console.log("will retrieve messages");
			fnRetrieveMessages(conn, last_ball_mci, bMultiAuthored, arrPayingAddresses, function(err, arrMoreMessages, assocMorePrivatePayloads){
				console.log("fnRetrieveMessages callback: err code = "+(err ? err.error_code : ""));
				if (err)
					return cb((typeof err === "string") ? ("unable to add additional messages: "+err) : err);
				Array.prototype.push.apply(objUnit.messages, arrMoreMessages);
				if (assocMorePrivatePayloads && Object.keys(assocMorePrivatePayloads).length > 0)
					for (var payload_hash in assocMorePrivatePayloads)
						assocPrivatePayloads[payload_hash] = assocMorePrivatePayloads[payload_hash];
				cb();
			});
		}
function(cb){
			if (!fnRetrieveMessages)
				return cb();
			console.log("will retrieve messages");
			fnRetrieveMessages(conn, last_ball_mci, bMultiAuthored, arrPayingAddresses, function(err, arrMoreMessages, assocMorePrivatePayloads){
				console.log("fnRetrieveMessages callback: err code = "+(err ? err.error_code : ""));
				if (err)
					return cb((typeof err === "string") ? ("unable to add additional messages: "+err) : err);
				Array.prototype.push.apply(objUnit.messages, arrMoreMessages);
				if (assocMorePrivatePayloads && Object.keys(assocMorePrivatePayloads).length > 0)
					for (var payload_hash in assocMorePrivatePayloads)
						assocPrivatePayloads[payload_hash] = assocMorePrivatePayloads[payload_hash];
				cb();
			});
		}
function ( cb ) { if ( ! fnRetrieveMessages ) return cb ( ) ; console . log ( "will retrieve messages" ) ; fnRetrieveMessages ( conn , last_ball_mci , bMultiAuthored , arrPayingAddresses , function ( err , arrMoreMessages , assocMorePrivatePayloads ) { console . log ( "fnRetrieveMessages callback: err code = " + ( err ? err . error_code : "" ) ) ; if ( err ) return cb ( ( typeof err === "string" ) ? ( "unable to add additional messages: " + err ) : err ) ; Array . prototype . push . apply ( objUnit . messages , arrMoreMessages ) ; if ( assocMorePrivatePayloads && Object . keys ( assocMorePrivatePayloads ) . length > 0 ) for ( var payload_hash in assocMorePrivatePayloads ) assocPrivatePayloads [ payload_hash ] = assocMorePrivatePayloads [ payload_hash ] ; cb ( ) ; } ) ; }
messages retrieved via callback
messages retrieved via callback