MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: machen (1008)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //usr/local/lib/node_modules/pm2/node_modules/js-git/lib/defer.js
"use strict";

var timeouts, messageName;

// node.js
if (typeof process === "object" && typeof process.nextTick === "function") {
  module.exports = process.nextTick;
}
// some browsers
else if (typeof setImmediate === "function") {
  module.exports = setImmediate;
}
// most other browsers
else {
  timeouts = [];
  messageName = "zero-timeout-message";
  window.addEventListener("message", handleMessage, true);

  module.exports = function (fn) {
    timeouts.push(fn);
    window.postMessage(messageName, "*");
  };
}

function handleMessage(event) {
  if (event.source == window && event.data == messageName) {
    event.stopPropagation();
    if (timeouts.length > 0) {
      var fn = timeouts.shift();
      fn();
    }
  }
}