packages/moon/src/executor/executor.js
function executeView(nodes, parents, indexes) {
	while (true) {
		let node = nodes.pop();
		const parent = parents.pop();
		const index = indexes.pop();

		if (node.type === types.component) {
			// Execute the component to get the component view.
			node = components[node.name](node.data);

			// Set the root view or current node to the new component view.
			if (parent === null) {
				setViewNew(node);
			} else {
				parent.data.children[index] = node;
			}
		}

		// Execute the views of the children.
		const children = node.data.children;

		for (let i = 0; i < children.length; i++) {
			nodes.push(children[i]);
			parents.push(node);
			indexes.push(i);
		}

		if (nodes.length === 0) {
			// Move to the diff phase if there is nothing left to do.
			executeDiff([viewOld], [viewNew], []);

			break;
		} else if (performance.now() - executeStart >= 16) {
			// If the current frame doesn't have sufficient time left to keep
			// running then continue executing the view in the next frame.
			requestAnimationFrame(() => {
				executeStart = performance.now();

				executeView(nodes, parents, indexes);
			});

			break;
		}
	}
}
function executeView(nodes, parents, indexes) {
	while (true) {
		let node = nodes.pop();
		const parent = parents.pop();
		const index = indexes.pop();

		if (node.type === types.component) {
			// Execute the component to get the component view.
			node = components[node.name](node.data);

			// Set the root view or current node to the new component view.
			if (parent === null) {
				setViewNew(node);
			} else {
				parent.data.children[index] = node;
			}
		}

		// Execute the views of the children.
		const children = node.data.children;

		for (let i = 0; i < children.length; i++) {
			nodes.push(children[i]);
			parents.push(node);
			indexes.push(i);
		}

		if (nodes.length === 0) {
			// Move to the diff phase if there is nothing left to do.
			executeDiff([viewOld], [viewNew], []);

			break;
		} else if (performance.now() - executeStart >= 16) {
			// If the current frame doesn't have sufficient time left to keep
			// running then continue executing the view in the next frame.
			requestAnimationFrame(() => {
				executeStart = performance.now();

				executeView(nodes, parents, indexes);
			});

			break;
		}
	}
}
function executeView ( nodes , parents , indexes ) { while ( true ) { let node = nodes . pop ( ) ; const parent = parents . pop ( ) ; const index = indexes . pop ( ) ; if ( node . type === types . component ) { // Execute the component to get the component view. node = components [ node . name ] ( node . data ) ; // Set the root view or current node to the new component view. if ( parent === null ) { setViewNew ( node ) ; } else { parent . data . children [ index ] = node ; } } // Execute the views of the children. const children = node . data . children ; for ( let i = 0 ; i < children . length ; i ++ ) { nodes . push ( children [ i ] ) ; parents . push ( node ) ; indexes . push ( i ) ; } if ( nodes . length === 0 ) { // Move to the diff phase if there is nothing left to do. executeDiff ( [ viewOld ] , [ viewNew ] , [ ] ) ; break ; } else if ( performance . now ( ) - executeStart >= 16 ) { // If the current frame doesn't have sufficient time left to keep // running then continue executing the view in the next frame. requestAnimationFrame ( ( ) => { executeStart = performance . now ( ) ; executeView ( nodes , parents , indexes ) ; } ) ; break ; } } }
Walks through the view and executes components.

@param {Array} nodes
@param {Array} parents
@param {Array} indexes
Walks through the view and executes components .