2014-07-18 08:18:53 +04:00
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Only add setZeroTimeout to the window object, and hide everything
|
|
|
|
// else in a closure.
|
|
|
|
(function() {
|
2015-01-24 16:37:18 +03:00
|
|
|
var resolved = Promise.resolve();
|
2014-07-18 08:18:53 +04:00
|
|
|
|
|
|
|
// Like setTimeout, but only takes a function argument. There's
|
|
|
|
// no time argument (always zero) and no arguments (you have to
|
|
|
|
// use a closure).
|
|
|
|
function setZeroTimeout(fn) {
|
2015-01-24 16:37:18 +03:00
|
|
|
resolved.then(fn);
|
2014-07-18 08:18:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add the one thing we want added to the window object.
|
|
|
|
window.setZeroTimeout = setZeroTimeout;
|
|
|
|
})();
|