Expected Behavior
DataLoader should gracefully fall back to setTimeout if setImmediate is not supported on the browser.
Current Behavior
It crashes with an error ReferenceError: setImmediate is not defined.
Possible Solution
|
setImmediate || setTimeout; |
- setImmediate || setTimeout;
+ typeof setImmediate === 'function' ?
+ setImmediate :
+ (fn => {setTimeout(fn, 0);});
This code also fixes a problem of calling setTimeout without a delay number when it falls back.
Sorry, I didn't create a PR as I am not familiar with the Flow typing that this project is based on.
Expected Behavior
DataLoader should gracefully fall back to
setTimeoutifsetImmediateis not supported on the browser.Current Behavior
It crashes with an error
ReferenceError: setImmediate is not defined.Possible Solution
dataloader/src/index.js
Line 242 in 249b2b9
This code also fixes a problem of calling
setTimeoutwithout a delay number when it falls back.Sorry, I didn't create a PR as I am not familiar with the Flow typing that this project is based on.