PropertyMap

PropertyMap is a helper class for storing properties on objects. Instead of using a Map, we store the property map directly on the object itself, which provides better lookup performance. This is generally used to store the gpu resources corresponding to objects.

Constructor

new PropertyMap(prefix)

Create a new PropertyMap.

Parameters:
NameTypeDescription
prefixstring

The prefix of the properties name.

Methods

delete(object)

Delete the properties of the object.

Parameters:
NameTypeDescription
objectobject

The object to delete properties.

get(object) → {object}

Get the properties of the object. If the object does not have properties, create a new one.

Parameters:
NameTypeDescription
objectobject

The object to get properties.

Returns:
  • The properties of the object.
Type: 
object

size() → {number}

Get the number of objects that have properties.

Returns:
  • The number of objects that have properties.
Type: 
number