export class RAFTimer {
    constructor(node) {
        this.isStarted = false;
        this.node = node;
    }
    start() {
        this.isStarted = true;
        this.schedule();
    }
    stop() {
        this.isStarted = false;
    }
    schedule() {
        window.requestAnimationFrame(this.handleResolve.bind(this));
    }
    handleResolve() {
        if (this.node) {
            this.node.func(1);
            if (this.isStarted) {
                this.schedule();
            }
        }
    }
}
