refactor: remove unused budget option

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-04-13 08:30:58 +00:00 committed by GitHub
parent 9527b8f965
commit 1d4f481e65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,19 +1,16 @@
// eslint-disable-next-line import/no-default-export class IdlingRenderScheduler {
export default class IdlingRenderScheduler {
#renderers: Set<FrameRequestCallback>; #renderers: Set<FrameRequestCallback>;
#budget: number;
#rafId: number; #rafId: number;
#ricId: number; #ricId: number;
constructor(budget = 0) { constructor() {
this.#renderers = new Set(); this.#renderers = new Set();
this.#budget = budget;
this.#rafId = 0; this.#rafId = 0;
this.#ricId = requestIdleCallback((deadline) => this.#schedule(deadline)); this.#ricId = requestIdleCallback((deadline) => this.#schedule(deadline));
} }
#schedule(deadline: IdleDeadline): void { #schedule(deadline: IdleDeadline): void {
if (deadline.timeRemaining() > this.#budget) { if (deadline.timeRemaining()) {
this.#rafId = requestAnimationFrame((time) => { this.#rafId = requestAnimationFrame((time) => {
for (const renderer of this.#renderers) { for (const renderer of this.#renderers) {
renderer(time); renderer(time);