Use setImmediate if it is available; fallback to setTimeout.

- setImmediate is always available in Node v0.9+
- Fallback to setTimeout for web target