function Queue(task) {
        var _this = this;
        this.state = "pending";
        this.tasks = [];
        this.onNewTask = null;
        task && this.push(task);
        setImmediate(function () { return _this.run(); });
    }
/**
     * Instantiates a new queue.
     * @param task The first task that is about to run.
     */
Instantiates a new queue.
@param task The first task that is about to run.
Instantiates a new queue . @param task The first task that is about to run .
function Queue(task) {
        var _this = this;
        this.state = "pending";
        this.tasks = [];
        this.onNewTask = null;
        task && this.push(task);
        setImmediate(function () { return _this.run(); });
    }
function Queue ( task ) { var _this = this ; this . state = "pending" ; this . tasks = [ ] ; this . onNewTask = null ; task && this . push ( task ) ; setImmediate ( function ( ) { return _this . run ( ) ; } ) ; }
Instantiates a new queue.
Instantiates a new queue .