☑ Touchstart event and fire callback problem


I don’t know how to describe this question. It’s about the touchstart event.

It will fire('game:tap') when I touch the screen. And then, I got this error :

I have no idea about this problem.

Thank you in advance for your answers !

It looks like you’ve probably added an event listener with an undefined callback function.

e.g. this.on('touchstart', undefined, this);

The code you show above looks ok, perhaps you are listening for touchstart events somewhere else? Or you have deleted an object without detaching events?

Hi, dave! Thank you for your reply.

It was odd that this problem not occurs everytime. My code is simply copied from :


This game, Keepy Up, also has this problem when I launch it on Google Chrome, mobile pattern.

When I first opened this game, mobile pattern and made a break point in input.js, line 61, it played ok because the touchstart event was not fired and it didn’t break. Then I used Command + R to refresh this page and played the game again. It broke in input.js, line 61 and this problem appeared.

Ah, just been debugging this. Looks like a simple error in the fonts.js script…

Font.prototype.onTouchDown - function (e)   {
    if (!this.eventsEnabled) {


See the problem?

Font.prototype.onTouchDown - function (e) {
should be changed to
Font.prototype.onTouchDown = function (e) {

That should fix the errors.

Wow! That’s amazing. :+1: Much appreciated !

And now I wonder why, you could locate this bug accurately ?

Thanks again.:smile: