Fix setTimeoutCustom in worker thread (#6923)
Fix setTimeoutCustom in worker thread (#6923)

In worker thread, window doesn't exist so !window will raise a
referenceError. Check "typeof window" to fix this.

BUG #6922

Co-authored-by: Matthew Soulanille <9273a5b6411e133f7ea896903afbea22cf1c62ad@google.com>
tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs