Open JackWH opened 1 year ago
Thanks @jwdunn1 for the speedy reply 👍 The instance mode issue is a little different, I've added some clarification below.
The npm package doesn't export
any methods, so it can't be imported as a module. Instead the plugin has to be loaded into the global scope. In instance mode p5 won't always be available in the global scope, and the p5
class also might be imported under an alias.
These lines seem to be causing the problem. They assume a p5
variable is available at runtime. Even if the p5 runtime is loaded and available, hard-coding onto the p5.prototype
prevents using this plugin in a class which has a p5 instance assigned to a property. More info here.
If you'd welcome a PR for this, I can have a go at it! 😊
Fascinating! Thanks for your insights. Yes, contributions are welcome!
I got a prototype working last night, just need to make sure it stays backwards-compatible in the global context. Will get a PR up when I get some time to come back to this over the next few days. Thanks!
@JackWH Were you able to import the modified version (from the PR) successfully into your Yarn/TypeScript project?
Hi! 👋 Is this library still maintained? I've been unable to import it (cleanly, anyway) into a Yarn/TypeScript project, as no package is published on npm.
Furthermore, when I tried to copy the source code in manually, I couldn't get it to work with p5's Instance Mode. The library seems to assume p5 is always available globally, which is rarely the case in modern JS projects.
Thanks!