UNPKG

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 (30 loc) 742 B
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _chunk6PEHRAEPjs = require('./chunk-6PEHRAEP.js'); // shared/rolling-buffer.ts var RollingBuffer = class { static { _chunk6PEHRAEPjs.__name.call(void 0, 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; } }; exports.RollingBuffer = RollingBuffer; //# sourceMappingURL=chunk-6CYSQII7.js.map