-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Feature request: check p5.js "version" from code. #2525
Comments
+1 for this (or at least the version # at top of the p5.js file) |
@dhowe the version number is currently at the top of the file: https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/p5.js |
Thanks Lauren. |
@grege2 are you talking about a function you can call that will return the version number of the currently loaded p5 library? For example: |
Yes, that was the idea. Cheers, GE. |
I think it can just be a constant attached to the p5 object, ie. |
i'm confused. isn't the version that's running just whatever you specify in the |
@Spongman You don't necessarily have control if you're writing a library for p5 or similar |
@Spongman - Mmm, yes at present I specify the p5.js file in my <script> tag for my own development work. But I think I can foresee situations like @meiamsome mentioned, where I might not control the version. |
Yes that would be really useful, like having a |
Reopening as it is important for a number of use-cases. For one, when you are using the editor and want to report a bug in p5.js, there is no easy way (correct me if I'm wrong here) to get the version from the bundled app |
+1 as I also needed the constant from a bundled script. I think adding this to the constants would make sense (e.g. THREE.js) |
@lmccart @limzykenneth I would like to work on this, if the issue is open. |
@limzykenneth Can I submit a PR if this issue isn't already taken? |
I just noticed that the const is only accessible when p5 is instantiated, which I totally didn't think about. This can be problematic in some (or most) use cases (when you need to check version after loading the module but before instantiation). Or am I missing something? if so please close the issue :) |
Maybe instead of defining the version number in |
Nature of issue?
Most appropriate sub-area of p5.js?
Details about the bug:
New feature details:
It could be useful to have the p5.js version no. accessible from a properties query in code, ie. be able to read the "0.5.16" as above. In my case, this is just to ensure I'm running on a version no earlier than the one I developed on, a reasonable precaution. However, I'm aware that coding to explicit releases can lead to a minefield of special casing, which we already have mountains of in Web design, eg. the plethora of ugly hacks to deal with old Internet Explorers. Maybe p5.js designers are avoiding this.
(PS. Can I get it cleanly from project.version ? I'm not a JS expert.)
Thanks, GE.
The text was updated successfully, but these errors were encountered: