Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: TouchEvent is not defined #1317

Closed
paulkaplan opened this issue Jan 22, 2018 · 5 comments
Closed

ReferenceError: TouchEvent is not defined #1317

paulkaplan opened this issue Jan 22, 2018 · 5 comments

Comments

@paulkaplan
Copy link
Contributor

TouchEvent is not always defined. Reported via Sentry. Doesn't seem to be a crashing error.

ReferenceError: TouchEvent is not defined
  at value (/lib.min.js:35:75460)
  at l (/lib.min.js:1:8318)
@towerofnix
Copy link
Contributor

Going to quote my (duplicate-of-this) issue:

The "bad" line follows:

https://github.com/LLK/scratch-gui/blob/fc388b63c89559c4f25d069db84b49912b7a77fc/src/containers/stage.jsx#L203

Any non-left click makes the second condition, e instanceof TouchEvent, run. According to the compatibility section for TouchEvent, it looks like TouchEvent is defined only on Windows systems. Yikes!

@AmazingMech2418
Copy link

@towerofnix Browsers define the JavaScript functions, not the system.

@towerofnix
Copy link
Contributor

@amazinigmech2418 Sure, but the browser can choose to define functions according to whatever system you're on. It seems silly to me to do that, but apparently Firefox does, per my link.

[2] As of Gecko 52.0, touch events support has been fixed and reenabled in Windows desktop platforms.

@AmazingMech2418
Copy link

@towerofnix That says that Windows can now use it. The touch events need to be processed by the browser from the actual event in the hardware. They just updated the event reader.

@regcole
Copy link

regcole commented Sep 10, 2018

@paulkaplan @towerofnix @amazinigmech2418

To get this working (on FF at least)
change the line to

   if (e.button === 0 || window.TouchEvent && e instanceof TouchEvent) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants