ifc-file-reader.js main.js
Copy export function readIfcFile () {
const input = document .querySelector ( 'input[type="file"]' );
if ( ! input) return ;
input .addEventListener (
'change' ,
(e) => {
readFile (input);
} ,
false
);
}
function readFile (input) {
const reader = new FileReader ();
reader . onload = () => {
const loaded = loadIfc ( reader .result);
scene .add ( loaded .MainObject);
};
reader .readAsText ( input .files[ 0 ]);
}
readIfcFile ();
var element = document .getElementById ( 'loading' );
element . parentNode .removeChild (element);
Copy export function readIfcFile () {
const input = document .querySelector ( 'input[type="file"]' );
input .addEventListener (
'change' ,
(e) => {
readFile (input);
} ,
false
);
}
function readFile (input) {
// TODO
}
readIfcFile ();
document .getElementById ( 'c' ). style .display = 'none' ;
toggleLoader ();
example/web-worker/main.js
Copy function readFile (input) {
const reader = new FileReader ();
reader . onload = () => {
// DO STUFF HERE
};
};
reader .readAsText ( input .files[ 0 ]);
}
Til' this point, everything should be pretty easy. Now - let's start implementing the Web Worker.
example/web-worker/main.js
Copy function readFile (input) {
const reader = new FileReader ();
reader . onload = () => {
const ifcWorker = new Worker ( 'worker/worker.js' );
};
reader .readAsText ( input .files[ 0 ]);
}