stefanpenner / es6-promise

A polyfill for ES6-style Promises
MIT License
7.3k stars 593 forks source link

Why are you using setTimeout(1) instead of setTimeout(0)? #350

Closed senaev closed 5 years ago

senaev commented 5 years ago

https://github.com/stefanpenner/es6-promise/blob/314e4831d5a0a85edcb084444ce089c16afdcbe2/lib/es6-promise/asap.js#L79

Why you are waiting one millisecond instead of zero?

senaev commented 5 years ago

I am asking because it causes some troubles in environment with faked Date and setTimeout objects. Would it be harmless if I change value to zero?

stefanpenner commented 5 years ago

Ya. Should be harmless, most platforms clamp it to 4ms anyways. So it shouldn’t make much of a difference anyways

senaev commented 5 years ago

Made pull-request https://github.com/stefanpenner/es6-promise/issues/350

stefanpenner commented 5 years ago

thanks!