life
Version:
Life.js is the first fullstack framework to build agentic web applications. It is minimal, extensible, and typesafe. Well, everything you love.
35 lines (33 loc) • 619 B
JavaScript
import {
__name
} from "./chunk-2D3UJWOA.mjs";
// shared/rolling-buffer.ts
var RollingBuffer = class {
static {
__name(this, "RollingBuffer");
}
#maxSize;
#buffer = [];
constructor(maxSize) {
this.#maxSize = maxSize;
}
add(chunk) {
this.#buffer.push(chunk);
if (this.#buffer.length > this.#maxSize) {
this.#buffer.splice(0, this.#buffer.length - this.#maxSize);
}
}
get() {
return this.#buffer;
}
empty() {
this.#buffer.length = 0;
}
length() {
return this.#buffer.length;
}
};
export {
RollingBuffer
};
//# sourceMappingURL=chunk-LPKEDFLM.mjs.map