Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Mar 7, 2024
1 parent c3d8c21 commit bc57aaf
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 36 deletions.
31 changes: 17 additions & 14 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7495,22 +7495,25 @@ const frame = function () {
lastTime = time;
};

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();
}
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
}
};
}

new WorkerInterval(frame, 100);
customSetInterval(() => {
frame();
}, 100);

const renderFrame = function () {
let time = Date.now();
Expand Down
31 changes: 17 additions & 14 deletions dist/xeokit-sdk.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -7491,22 +7491,25 @@ const frame = function () {
lastTime = time;
};

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();
}
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
}
};
}

new WorkerInterval(frame, 100);
customSetInterval(() => {
frame();
}, 100);

const renderFrame = function () {
let time = Date.now();
Expand Down
5 changes: 3 additions & 2 deletions dist/xeokit-sdk.es5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xeokit-sdk.min.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xeokit-sdk.min.es.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/xeokit-sdk.min.es5.js

Large diffs are not rendered by default.

0 comments on commit bc57aaf

Please sign in to comment.