File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import {
1717} from '../../../../build/three.module.js' ;
1818
1919var ifcAPI = new IfcAPI ( ) ;
20- ifcAPI . Init ( ) ;
2120
2221function IFCLoader ( manager ) {
2322
@@ -40,11 +39,11 @@ IFCLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
4039 loader . setWithCredentials ( scope . withCredentials ) ;
4140 loader . load (
4241 url ,
43- function ( buffer ) {
42+ async function ( buffer ) {
4443
4544 try {
4645
47- onLoad ( scope . parse ( buffer ) ) ;
46+ onLoad ( await scope . parse ( buffer ) ) ;
4847
4948 } catch ( e ) {
5049
@@ -69,9 +68,13 @@ IFCLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
6968
7069 } ,
7170
72- parse : ( function ( ) {
71+ parse : async function ( buffer ) {
7372
74- return function ( buffer ) {
73+ if ( ifcAPI . wasmModule === undefined ) {
74+
75+ await ifcAPI . Init ( ) ;
76+
77+ }
7578
7679 var data = new Uint8Array ( buffer ) ;
7780 var modelID = ifcAPI . OpenModel ( 'example.ifc' , data ) ;
@@ -168,9 +171,7 @@ IFCLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
168171
169172 }
170173
171- } ;
172-
173- } ) ( ) ,
174+ }
174175} ) ;
175176
176177export { IFCLoader } ;
You can’t perform that action at this time.
0 commit comments