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

Usability: Common Constants #33

Open
LoganPress opened this issue Mar 30, 2021 · 5 comments
Open

Usability: Common Constants #33

LoganPress opened this issue Mar 30, 2021 · 5 comments

Comments

@LoganPress
Copy link

Some constants, such as PI, can only be accessed as properties of the sketch object. However, other enum values such as CLOSE (ie for endShape) can be accessed either as a direct property of the sketch object, or as a property of the VueP5 library. Doesn't it make sense to wrap other, non-sketch-specific constants to be accessible through the top-level VueP5?

@Kinrany
Copy link
Owner

Kinrany commented Mar 30, 2021

Interesting, not sure why they're accessible on the library object. I will look into it, thanks for the tip 🙂

@LoganPress
Copy link
Author

No problem. I'm pretty new to this library, is there a reason that you wouldn't want constants accessible on the library object? It seems that because these constants aren't specific to any specific sketch, they should be globally accessible.

@Kinrany
Copy link
Owner

Kinrany commented Mar 30, 2021

Only general considerations of keeping the API simple.

I do see the point that in the context of a Vue app, vue-p5 acts as a replacement for p5, and it would make sense to import constants from 'vue-p5' instead of having a separate import { PI } from 'p5'.

@sniperadmin
Copy link

Yes, this is a WIP solution that we are into..
with the next update, we will be able to use all p5 constants

@Kinrany
Copy link
Owner

Kinrany commented Oct 13, 2021

Right now p5 is reexported, so all p5 exports are available globally that way and there's no need to have p5 as a separate dependency. I'll wait for more feedback to see if there is another problem to be solved here.

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

No branches or pull requests

3 participants