const Cycle = require("./cycle").Cycle; const logger = require("./logger"); class CycleBuffer { constructor(purgeTime) { this.time = purgeTime; this.buffer=[]; var th = this; this.onclear = function(sp) {}; this.inter = setInterval(function() { th.purge(); }, this.time); } purge() { this.onclear(this); this.buffer.length=0; } add(cycle) { this.buffer.push(cycle); } all() { var ret=[]; for(var i=0;i