A browser-based BIM viewer, built on the xeokit SDK
Full Changelog: https://github.com/xeokit/xeokit-bim-viewer/compare/v2.5.1-beta-19...v2.5.1-beta-20
Full Changelog: https://github.com/xeokit/xeokit-bim-viewer/compare/v2.5.1-beta-18...v2.5.1-beta-19
Includes a xeokit-sdk alternative technique for implementing a custom setInterval that runs in a background tab, for the purpose of loading models in the background.
Previously we used a Worker, but one user reports security issues using the Worker behind Apache (see https://github.com/xeokit/xeokit-bim-viewer/issues/168), so we needed to change to a different technique that does not use a Worker.
class WorkerInterval {
worker = null;
constructor(callback, interval) {
const blob = new Blob([`setInterval(() => postMessage(0), ${interval});`]);
const workerScript = URL.createObjectURL(blob);
this.worker = new Worker(workerScript);
this.worker.onmessage = callback;
}
stop() {
this.worker.terminate();
}
}
const interval = new WorkerInterval(frame, 100);
function customSetInterval(callback, interval) {
let expected = Date.now() + interval;
function loop() {
const elapsed = Date.now() - expected;
callback();
expected += interval;
setTimeout(loop, Math.max(0, interval - elapsed));
}
loop();
return {
cancel: function() {
// No need to do anything, setTimeout cannot be directly cancelled
}
};
}
customSetInterval(() => {
frame();
}, 100);
Full Changelog: https://github.com/xeokit/xeokit-bim-viewer/compare/v2.5.1-beta-12...v2.5.1-beta-13