function writeElements(res, elements) {

	// Pick up where we left off.
	var start = RLS().nextElement||(RLS().nextElement=0);

	for (var i = start; i < elements.length; RLS().nextElement = ++i){

		// If we haven't rendered the next element yet, we're done.
		if (elements[i] === ELEMENT_PENDING) break;

		// Got one!
		writeElement(res, elements[i], i);

		// Free for GC.
		elements[i] = ELEMENT_ALREADY_WRITTEN;

		if (PageUtil.PageConfig.get('isFragment')) continue;

		if (RLS().haveBootstrapped) {

			// We've already bootstrapped, so we can immediately tell the
			// client controller to wake the new element we just sent.
			wakeElementRange(res, i, i);
		} else if (i === elements.length - 1) {

			// Page didn't emit `<TheFold/>`.  Now we're done.
			// This wakes everything up through `i`.
			bootstrapClient(res, i);
		}
	}

	// It may be a while before we render the next element, so if we just
	// wrote anything let's send it down right away.
	if (i !== start) flushRes(res);
}
function writeElements(res, elements) {

	
	var start = RLS().nextElement||(RLS().nextElement=0);

	for (var i = start; i < elements.length; RLS().nextElement = ++i){

		
		if (elements[i] === ELEMENT_PENDING) break;

		
		writeElement(res, elements[i], i);

		
		elements[i] = ELEMENT_ALREADY_WRITTEN;

		if (PageUtil.PageConfig.get('isFragment')) continue;

		if (RLS().haveBootstrapped) {

			
			
			wakeElementRange(res, i, i);
		} else if (i === elements.length - 1) {

			
			
			bootstrapClient(res, i);
		}
	}

	
	
	if (i !== start) flushRes(res);
}
function writeElements ( res , elements ) { // Pick up where we left off. var start = RLS ( ) . nextElement || ( RLS ( ) . nextElement = 0 ) ; for ( var i = start ; i < elements . length ; RLS ( ) . nextElement = ++ i ) { // If we haven't rendered the next element yet, we're done. if ( elements [ i ] === ELEMENT_PENDING ) break ; // Got one! writeElement ( res , elements [ i ] , i ) ; // Free for GC. elements [ i ] = ELEMENT_ALREADY_WRITTEN ; if ( PageUtil . PageConfig . get ( 'isFragment' ) ) continue ; if ( RLS ( ) . haveBootstrapped ) { // We've already bootstrapped, so we can immediately tell the // client controller to wake the new element we just sent. wakeElementRange ( res , i , i ) ; } else if ( i === elements . length - 1 ) { // Page didn't emit `<TheFold/>`.  Now we're done. // This wakes everything up through `i`. bootstrapClient ( res , i ) ; } } // It may be a while before we render the next element, so if we just // wrote anything let's send it down right away. if ( i !== start ) flushRes ( res ) ; }
Write as many elements out in a row as possible and then flush output. We render elements as their data becomes available, so they might fill in out-of-order.
Write as many elements out in a row as possible and then flush output . We render elements as their data becomes available so they might fill in out - of - order .