Hi @alex
I come back to this sandbox you wrote to load and show/hide multiple versions of a model :
When I import just before a function from a ts extensions, it runs multiple times (as many as the versions loaded). Example :
I guess it’s because it is async? Have you an idea how to bypass this? Because I still need the viewer to be loaded before running the function.
Thanks,
Raphaël
For each loadObject call you make, a ViewerEvent.LoadComplete event will get emitted with the corresponding object id.
So I guess that if you want to know when all objects that you asked the viewer to load have finished loading, you just need to keep track of them in the ViewerEvent.LoadComplete events by looking at which object finished, and so determining if there are any others waiting to finish loading
Hi @alex
Thanks ok nice I understand. I keep track of the loaded versions so :
let loadedVersions: number = 0
viewer.on(ViewerEvent.LoadComplete, async () => {
loadedVersions = loadedVersions + 1
/** Functions to run one time for all versions */
if (loadedVersions === 1) {
menu.addMenu();
navigation.addNavigation(cameraController);
}
/** Functions to run for each version */
nominations.addNominations();
sets.buildSetsTree();
});