toffee
Version:
A NodeJs and browser-side templating language based on CoffeeScript with slicker tokens and syntax.
33 lines (25 loc) • 572 B
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
var Pool;
Pool = (function() {
function Pool(cons, size) {
this._consfn = cons;
this._size = size;
this._pool = [];
}
Pool.prototype.get = function() {
if (this._pool.length > 0) {
return this._pool.pop();
} else {
return this._consfn();
}
};
Pool.prototype.release = function(x) {
if (this._pool.length < this._size) {
return this._pool.push(x);
}
};
return Pool;
})();
exports.Pool = Pool;
}).call(this);