este-library-oldschool
Version:
Library for github.com/steida/este.git
68 lines (61 loc) • 1.67 kB
JavaScript
// Generated by github.com/steida/coffee2closure 900.1.18
/**
@fileoverview este.app.request.Queue.
*/
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.superClass_ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
goog.provide('este.app.request.Queue');
goog.require('goog.array');
goog.require('goog.Disposable');
/**
@constructor
@extends {goog.Disposable}
*/
este.app.request.Queue = function() {
this.pendings = [];
}
extend(este.app.request.Queue, superClass);
/**
@type {Array.<este.app.Request>}
@protected
*/
este.app.request.Queue.prototype.pendings = null;
/**
@param {este.app.Request} request
*/
este.app.request.Queue.prototype.add = function(request) {
return this.pendings.push(request);
};
/**
@param {este.app.Request} request
*/
este.app.request.Queue.prototype.contains = function(request) {
var i, len, pending, ref;
ref = this.pendings;
for (i = 0, len = ref.length; i < len; i++) {
pending = ref[i];
if (pending.equal(request)) {
return true;
}
}
return false;
};
/**
@return {boolean}
*/
este.app.request.Queue.prototype.isEmpty = function() {
return !this.pendings.length;
};
/**
Clear pendings requests.
*/
este.app.request.Queue.prototype.clear = function() {
return this.pendings.length = 0;
};
/**
@override
*/
este.app.request.Queue.prototype.disposeInternal = function() {
this.clear();
return este.app.request.Queue.superClass_.disposeInternal.call(this);
};