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.

Custom properties in existing classes

See original GitHub issue

Some generically named properties like speed and rotating and paused etc. don’t really belong directly in existing classes IMO. I’d like a .custom property (a simple hash) that I can assign such properties to. Not in extensions of existing classes, but in their objects:

var block = new THREE.Mesh(geo, material);
block.custom.speed = 1; // instead of block.speed = 1

block.speed is not very safe, forward compatibility wise, especially with the lib being in dev.

Assigning my own .custom to the prototype won’t work however, because then all objects share 1 custom hash:

THREE.Object3D.prototype.custom = {};

It’s a feature request, but very simple: add this.custom = {}; to the Object3D constructor.

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mrdoobcommented, Feb 9, 2012

To be honest, I don’t yet understand what you wanted. But if you think this issue is closed, then it’s closed 😃

1reaction
mrdoobcommented, Jan 26, 2012

But… couldn’t you do that on the application level? Sometimes I add my custom data to objects on my apps just like this:

var block = new THREE.Mesh(geo, material);
block.custom = { speed: 1 };
Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Custom Properties for a Class - CloudShare Support
Go to the Class Details page of the class where you want to add or edit custom properties. · Click the Properties tab....
Read more >
Using CSS custom properties (variables) - MDN Web Docs
Custom properties (sometimes referred to as CSS variables or cascading variables) are entities defined by CSS authors that contain specific ...
Read more >
A Complete Guide to Custom Properties | CSS-Tricks
Everything important and useful to know about CSS Custom Properties. Like that they are often referred to as "CSS Variables" but that's not ......
Read more >
4. Implementing a Custom Property Class - Python Courses eu
We define a class with the name 'our_property' so that it will not be mistaken for the existing 'property' class. This class can...
Read more >
Make Java Properties available across classes?
Load the properties once using and store the Properties somewheres that others classes can pull from. If that is a MyProperties ...
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