archilogic-com / 3dio-js

JavaScript toolkit for interior apps

Home Page:https://3d.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

utils/processing methods cannot be called from node.js because of window reference

bnjm opened this issue · comments

To reproduce

call io3d.utils.processing.whenDone from any node.js runtime

Actual result

Thrown error: window is not defined

Expected

Either method to work, or error message like "method not supported from non-browser environments"

An error message should only be a temporary solution

Sorry I did not mean to push to master, but easy fix in fcf5955

Since I pushed to master without the chance for a review, I will just explain that the problem was caused by using window.setTimeout instead of setTimeout.

Probably window.setTimeout is nicer to use since it avoids introducing a new global reference, but it throws an error in node.js... also global setTimeout is referenced a few times elsewhere like https://github.com/archilogic-com/3dio-js/blob/master/src/utils/wait.js