If I have JavaScript classes defined in a library like three.js, how can I call the constructor from Blazor WebAssembly and instantiate objects?
I have tried
var threeJs = await Js.InvokeAsync<IJSInProcessObjectReference>("import", "https://threejsfundamentals.org/threejs/resources/threejs/r125/build/three.module.js");
var scn = threeJs.Invoke<IJSInProcessObjectReference>("new THREE.Scene");
but this results in an error saying "Microsoft.JSInterop.JSException: Could not find 'new THREE.Scene' ('new THREE' was undefined)."
Is it possible to instantiate JavaScript classes without making a JavaScript wrapper function which instantiates the object?
You can't call new THREE.Scene by itself. You can do something like const scene = new THREE.Scene. But, I don't know what good instantiating a variable in JSInterop would do.