We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm getting a funky bug using p5.js mode in the P3 PDE. I can create a javascript class, defined at the top or bottom of the main sketch file, or out in its own separate file. And I can instantiate the class and invoke methods on the object. Super tight! But as soon as I save either js file, I get a compiler error on the class definition 'SyntaxError: Expected an operand but found class'. If I delete all the class/object code, I still get the same error, until I save the file. After I save the file(s), happy compiler again (but no classes/objects).
Any workaround?
Answers
My bad! I'm new to OO in JavaScript. Many easy workarounds without using 'class':
https://phpied.com/3-ways-to-define-a-javascript-class/
https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
Thanks GoToLoop! That's the exact code I used initially! Worked perfectly until I saved the file(s). I changed them to match older workarounds I posted from phpied.com, and everything smooth again, including file save.