@Mugen87 Appreciate your response!
I followed your suggestion of working with promises and could make things work using following:
const _THREEJSHELPER = {
asyncModelLoader: (url) => {
let loader = new GLTFLoader();
return new Promise((resolve, reject) => {
loader.load(url, data => resolve(data), null, reject);
})
}
}
Used it like this:
(async () => {
let tempObject = await _THREEJSHELPER.asyncModelLoader('models/object.glb');
obj2 = tempObject.scene;
scene.add(obj2);
})();
Referred to this post.