How to block [Violation] 'requestAnimationFrame' handler took <number>ms

im making an evolutionary system, where if you click the screen things spped up 50x, but this reduces framerate to a bit less than 20, and this generates the alert
[Violation] ‘requestAnimationFrame’ handler took ms
but i dont want this alert, how can i block it?

i already tried
console.warn = function() {}

but it didnt work

I mean, the snarky answer is ‘dont do something that’ll slow down the animation so much that it’ll generate the error’.

You can tell your console not to show you the Warning level events (This violation is a Warning-level event).

1 Like

i would like something to put in my code, not something that the user have to do

You have a certain amount of work that needs to be done. When the computer complains that it can’t do all of that work in time, what do you think should be done?

I propose that you should monitor the framerate, and when the computer can’t keep up that you reduce the amount of work that it needs to do.