meteor/meteor — pull request #1023 by awwx (2013-05-07 19:01:14+00:00)
Title: Support Meteor.defer in inactive iOS tabs.

In iOS Safari, `setTimeout` and `setInterval` events are not delivered
to inactive tabs (unless and until they become active again). This
means that using `setTimeout(fn, 0)` to run `fn` in the next event
loop can in fact delay `fn` indefinitely.

This implementation uses the native `setImmediate` (when available) or
`postMessage` (all other modern browsers); falling back to
`setTimeout` if the first two aren't available.

The `qa` subdirectory includes a manual test to check that `defer` is
working in inactive tabs. (Sadly the test can't run automatically
because scripts aren't allowed to open child windows except in
response to user events).

Factors out some common code in `timers.js`.