{"size": 703, "ext": "js", "max_stars_repo_path": "packages/marko/src/runtime/nextTick-browser.js", "max_stars_repo_name": "tigt/marko", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "packages/marko/src/runtime/nextTick-browser.js", "max_issues_repo_name": "tigt/marko", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/marko/src/runtime/nextTick-browser.js", "max_forks_repo_name": "tigt/marko", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.0857142857, "max_line_length": 71, "alphanum_fraction": 0.5248933144}
/* globals window */

var win = window;
var setImmediate = win.setImmediate;

if (!setImmediate) {
  if (win.postMessage) {
    var queue = [];
    var messageName = "si";
    win.addEventListener(
      "message",
      function(event) {
        var source = event.source;
        if (source == win || (!source && event.data === messageName)) {
          event.stopPropagation();
          if (queue.length > 0) {
            var fn = queue.shift();
            fn();
          }
        }
      },
      true
    );

    setImmediate = function(fn) {
      queue.push(fn);
      win.postMessage(messageName, "*");
    };
  } else {
    setImmediate = setTimeout;
  }
}

module.exports = setImmediate;
