"use strict";var RingBuffer=require("./ring_buffer"),Pledge=function(){this._complete=!1,this._callbacks=new RingBuffer(Pledge.QUEUE_SIZE)};Pledge.QUEUE_SIZE=4,Pledge.all=function(e){var t=new Pledge,n=e.length,l=n;for(0===n&&t.done();l--;)e[l].then(function(){0===(n-=1)&&t.done()});return t},Pledge.prototype.then=function(e){this._complete?e():this._callbacks.push(e)},Pledge.prototype.done=function(){this._complete=!0;for(var e,t=this._callbacks;e=t.shift();)e()},module.exports=Pledge;