JS: use of setImmediate/clearImmediate should be optional
Currently the JS RTS uses setImmediate
/clearImmediate
API which aren't supported in most Web browsers (see https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate#browser_compatibility). We should fall back to another implementation when they aren't available.