dev: Add warning for unbound .tick() call
This commit is contained in:
parent
74b338ac17
commit
963b03ab6e
1 changed files with 7 additions and 0 deletions
|
@ -120,6 +120,13 @@ export default class Ticker {
|
|||
* @see onNextTick
|
||||
*/
|
||||
tick(t: number = performance.now()) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (!(this instanceof Ticker)) {
|
||||
throw new Error(
|
||||
'ticker.tick must be called while bound to the ticker. As in, "ticker.tick(time)" or "requestAnimationFrame((t) => ticker.tick(t))" for performance.',
|
||||
)
|
||||
}
|
||||
}
|
||||
this._ticking = true
|
||||
this._timeAtCurrentTick = t
|
||||
for (const v of this._scheduledForNextTick) {
|
||||
|
|
Loading…
Reference in a new issue