lib/file.js
function safe3(fn) {
  var queue = Queue.new();
  var safe = true;
  function checkQueue() {
    var next = queue.shift();
    safe = false;
    fn(next[0], next[1], next[2], function (error, result) {
      next[3](error, result);
      if (queue.length > 0) {
        checkQueue();
      } else {
        safe = true;
      }
    });
  }
  return function (arg1, arg2, arg3, callback) {
    queue.push(arguments);
    if (safe) {
      checkQueue();
    }
  };
}
function safe3(fn) {
  var queue = Queue.new();
  var safe = true;
  function checkQueue() {
    var next = queue.shift();
    safe = false;
    fn(next[0], next[1], next[2], function (error, result) {
      next[3](error, result);
      if (queue.length > 0) {
        checkQueue();
      } else {
        safe = true;
      }
    });
  }
  return function (arg1, arg2, arg3, callback) {
    queue.push(arguments);
    if (safe) {
      checkQueue();
    }
  };
}
function safe3 ( fn ) { var queue = Queue . new ( ) ; var safe = true ; function checkQueue ( ) { var next = queue . shift ( ) ; safe = false ; fn ( next [ 0 ] , next [ 1 ] , next [ 2 ] , function ( error , result ) { next [ 3 ] ( error , result ) ; if ( queue . length > 0 ) { checkQueue ( ) ; } else { safe = true ; } } ) ; } return function ( arg1 , arg2 , arg3 , callback ) { queue . push ( arguments ) ; if ( safe ) { checkQueue ( ) ; } } ; }
Makes an async function that takes 3 arguments only execute one at a time.
Makes an async function that takes 3 arguments only execute one at a time .