How to prohibit code execution before downloading?

I want the model and the code step by step

// Progress
function onProgress( xhr ) {

	if ( xhr.lengthComputable ) {

		const percentComplete = xhr.loaded / xhr.total * 100;
		console.log( Math.round( percentComplete, 2 ) + '% downloaded' );

	}

}

function onError() {

	const message = "Error loading model";
	console.log( message );

}




console.log('Start load')
const loader = new GCodeLoader();
loader.load( 'models/gcode/benchy.gcode', function ( object ) {

	object.position.set( - 100, - 20, 100 );
	scene.add( object );


}, onProgress , onError);
console.log('End load for mode l ')

loader.load( 'models/gcode/benchy.gcode', function ( object ) {

	object.position.set( - 100, - 20, 100 );
	scene.add( object );


}, onProgress , onError);


console.log('End load for mode 2 ')




console.log('Run animate')
const animate = function () {
	requestAnimationFrame( animate );
	renderer.render( scene, camera );
};

animate();

How do I do it right?
Desirable with an explanation.

If you want to load model 1 and then model 2 you have to start the loading process of model 2 in the onLoad() callback of model 1. So:

console.log('Start load')

const loader = new GCodeLoader();
loader.load( 'models/gcode/benchy.gcode', function ( model1 ) {

	model1 .position.set( - 100, - 20, 100 );
	scene.add( model1 );

	console.log('End load for model 1 ')

	loader.load( 'models/gcode/benchy.gcode', function ( model2 ) {

		model2 .position.set( - 100, - 20, 100 );
		scene.add( model2 );

		console.log('End load for model 2 ')

	}, onProgress , onError);

}, onProgress , onError);