refactor: remove unused budget option
This commit is contained in:
parent
9527b8f965
commit
1d4f481e65
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue