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

Create public API #40

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Create public API #40

wants to merge 8 commits into from

Conversation

ReinderVosDeWael
Copy link
Contributor

@ReinderVosDeWael ReinderVosDeWael commented Sep 11, 2023

This draft PR is meant as a starting point to address #39. At present, it refactors the models to the set-up proposed by this issue. As there is no attribute type that allows public read-only but private writing, I've set the attributes to private but added a get object for read access.

I consider everything in this PR to be an early draft, so feel free to modify anything.

@ReinderVosDeWael ReinderVosDeWael self-assigned this Sep 11, 2023
@ReinderVosDeWael ReinderVosDeWael changed the title Feature/finalize-api Create public API Sep 11, 2023
Copy link
Contributor

@nx10 nx10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about using properties here, otherwise it looks good 👍

get(propertyName: "vertices"): Float32Array;
get(propertyName: "faces"): Uint32Array;
get(propertyName: "vertices" | "faces") {
return this[propertyName];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these have to be properties? Why not either public or readonly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose this because I wanted it to be readonly, but readonly also prevents private writing. This was the workaround I found towards that end; would you just make them public?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah seems like it's a missing language feature microsoft/TypeScript#37487

I'm fine with whatever then. Probably I would prefer just obj.getIntensity() for auto complete convenience but do what you think is best.

get(propertyName: "colorMapName"): ColorInterpolateName;
get(propertyName: "colors"): Float32Array;
get(propertyName: "intensity" | "colorLimits" | "colorMapName" | "colors") {
return this[propertyName];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See same comment chain above

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

Successfully merging this pull request may close these issues.

Add a method/attribute to access intensity
2 participants