Forums > Javascript

symbol_unique() in Javascript?

Sep 09 2011 | 11:13 am

Does the Javascript API expose symbol_unique() anywhere?

I’m looking but not finding it.

The issue is that I’m calling new JitterObject() for a, and the returned object doesn’t have a name component ( appears to be ""). I can programmatically set the name, but if I re-instantiate the Javascript the name is no longer unique and ob3d complains. Hence the need for something like symbol_unique().

Sep 12 2011 | 12:47 pm

Is something unclear about the question or is everybody just too busy with other stuff?

Sep 13 2011 | 9:49 pm

Hi Peter,
as far as i know there is no such object/method in JavaScript.
A posible solution that comes to my mind would be to use the actual timestamp as part of the name-string. When using micro seconds that should be able to create a unique string.
Or you could create a JavaScript object in the global scope that carries an incremental index. Add this index to a string an raise it by 1 each time you instantiate your object.
Best jan.

Sep 14 2011 | 5:09 pm

Thanks, Jan!

Appending works fine for my purposes.

It does seem strange that objects don’t automatically get a unique string when they’re instantiated in Javascript.

Sep 15 2011 | 1:36 am

Yes indeed it is strange that is doesn’t – especially other objects like jit.matrix do expose their automatically created names. Sounds like a bug for me…

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Javascript