callBack 関数が true を返す間、定期的に関数を呼び出す class Repeater { #cnt = null; #timerId = null; #loop = function () { if (this.#cnt && this.cbFunc (--this.#cnt) && this.#cnt) this.#timerId = setTimeout (this.#loop.bind (this), this.interval); else this.stop (); } //_______ constructor (cbFunc, count, interval) { …