question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose the objects holding constants

See original GitHub issue

It’s useful for editors & data files to be able to enumerate constants. So instead of having "wrapS" : 1000 you can write "wrapS" : "RepeatWrapping", or if you want to construct a drop down for all the different texture filter modes etc. What seems to be the best approach at the moment is to copy & paste TEXTURE_FILTER, I think it would be better if they were just exported as is instead. Not only is it a whole lot cleaner than copy & paste, but it also guarantees that they’re in sync if new ones ever gets added or if it’s changed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
donmccurdycommented, Nov 13, 2019

I guess @Sairony is asking for all constants to be scoped under a particular namespace for their purpose. For example:

THREE.Mapping.UV
THREE.Mapping.CUBE_REFLECTION
THREE.Mapping.EQUIRECTANGULAR_REFLECTION
...
THREE.Wrapping.REPEAT
THREE.Wrapping.CLAMP_TO_EDGE
THREE.Wrapping.MIRRORED_REPEAT

From that perspective, the user can enumerate the choices in a dropdown with Object.keys(THREE.Wrapping) rather than having to maintain a matching list.

All else being equal I agree the scoped constants might be nice, but this seems like a major a hassle to change now, so I’m not sure we can justify moving all the constants.

1reaction
looeeecommented, Nov 14, 2019

I guess @Sairony is asking for all constants to be scoped under a particular namespace for their purpose.

Related: #12579, #12972

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to expose constant data - c++ - Stack Overflow
I am not sure if this is the best way to expose data in OOPS parlance. I have made variables const but const_cast...
Read more >
JavaScript Constants With Object.freeze() - DEV Community ‍ ‍
You don't actually need objects to organize your constants, you could simply have a constants directory instead of a constants file, and then ......
Read more >
Python Constants: Improve Your Code's Maintainability
Constants can only be accessed, not written. This feature makes them thread-safe objects, which means that several threads can simultaneously ...
Read more >
How to Share Constants in Typescript Project - Medium
One way to manage constants in TypeScript is to use the class. In the following example, the AppSettings class is created with static...
Read more >
Constants (IBM WebSphere Application Server, Release 8.5)
This class will hold any constants exposed by the programming model. Application developers will be able to use these constants when developing JAX-WS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found