sample/gulp/gulpfile.js
function waitForCompletion(project) {
	return new Promise((resolve, reject) => {
		let warned = false;
		project.refreshUntilCompleted((completed, error) => {
			if (!error) {
				if (completed) {
					if (warned) {
						readLine.clearLine(process.stdout);  // clear "Waiting" line
						readLine.cursorTo(process.stdout, 0);  // move cursor to beginning of line
					}
					resolve();
				} else {
					if (!warned) {
						process.stdout.write("Waiting for " + project.name + " compilation to end ");
						warned = true;
					}
					process.stdout.write(".");
				}
			} else {
				reject(error);
			}
		});
	});
}
function waitForCompletion(project) {
	return new Promise((resolve, reject) => {
		let warned = false;
		project.refreshUntilCompleted((completed, error) => {
			if (!error) {
				if (completed) {
					if (warned) {
						readLine.clearLine(process.stdout);  // clear "Waiting" line
						readLine.cursorTo(process.stdout, 0);  // move cursor to beginning of line
					}
					resolve();
				} else {
					if (!warned) {
						process.stdout.write("Waiting for " + project.name + " compilation to end ");
						warned = true;
					}
					process.stdout.write(".");
				}
			} else {
				reject(error);
			}
		});
	});
}
function waitForCompletion ( project ) { return new Promise ( ( resolve , reject ) => { let warned = false ; project . refreshUntilCompleted ( ( completed , error ) => { if ( ! error ) { if ( completed ) { if ( warned ) { readLine . clearLine ( process . stdout ) ; // clear "Waiting" line readLine . cursorTo ( process . stdout , 0 ) ; // move cursor to beginning of line } resolve ( ) ; } else { if ( ! warned ) { process . stdout . write ( "Waiting for " + project . name + " compilation to end " ) ; warned = true ; } process . stdout . write ( "." ) ; } } else { reject ( error ) ; } } ) ; } ) ; }
Waits for the project to finish compiling. Then calls the callback
@param {Project} project
@return {Promise<void>}
Waits for the project to finish compiling . Then calls the callback