envjs / env-js

A pure-JavaScript browser environment.
http://www.envjs.com/
87 stars 19 forks source link

Call function synchronously when timeout is set to zero #22

Open orslumen opened 13 years ago

orslumen commented 13 years ago

Well, this is more of an enhancement request than a bug.

I am running my integration tests asynchronously. Next to that I make sure that (most) calls to setTimeout use a timeout of 0 (zero) during the integration tests, to perform well.

But timer.js by default adds all timers and intervals to the queue, regardless of the timeout value.

I would like setTimeout to synchronously call the given function when the timeout is set to zero, see e.g. https://github.com/orslumen/env-js/commit/fe499c2d38f8de8d3d290b76115f66506cc897b8