{"version":3,"file":"TimeLimiter.mjs","sources":["../src/TimeLimiter.ts"],"sourcesContent":["/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n * @memberof PIXI\n */\nexport class TimeLimiter\n{\n    /** The maximum milliseconds that can be spent preparing items each frame. */\n    public maxMilliseconds: number;\n\n    /**\n     * The start time of the current frame.\n     * @readonly\n     */\n    public frameStart: number;\n\n    /** @param maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. */\n    constructor(maxMilliseconds: number)\n    {\n        this.maxMilliseconds = maxMilliseconds;\n        this.frameStart = 0;\n    }\n\n    /** Resets any counting properties to start fresh on a new frame. */\n    beginFrame(): void\n    {\n        this.frameStart = Date.now();\n    }\n\n    /**\n     * Checks to see if another item can be uploaded. This should only be called once per item.\n     * @returns - If the item is allowed to be uploaded.\n     */\n    allowedToUpload(): boolean\n    {\n        return Date.now() - this.frameStart < this.maxMilliseconds;\n    }\n}\n"],"names":[],"mappings":"AAKO,MAAM,WACb,CAAA;AAAA,EAWI,YAAY,eACZ,EAAA;AACI,IAAA,IAAA,CAAK,eAAkB,GAAA,eAAA,CAAA;AACvB,IAAA,IAAA,CAAK,UAAa,GAAA,CAAA,CAAA;AAAA,GACtB;AAAA,EAGA,UACA,GAAA;AACI,IAAK,IAAA,CAAA,UAAA,GAAa,KAAK,GAAI,EAAA,CAAA;AAAA,GAC/B;AAAA,EAMA,eACA,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,GAAA,EAAQ,GAAA,IAAA,CAAK,aAAa,IAAK,CAAA,eAAA,CAAA;AAAA,GAC/C;AACJ;;;;"}