Expose the getUid function

It is often useful in application code to have a way to uniquely identify
and object.

Exposing the OpenLayers mechanism allows for best performance and avoid
unneccessary dirt.
This commit is contained in:
Guillaume Beraudo
2018-08-03 16:07:30 +02:00
parent 824ad48488
commit dbf9048d8f

View File

@@ -44,6 +44,7 @@ let uidCounter_ = 0;
*
* @param {Object} obj The object to get the unique ID for.
* @return {number} The unique ID for the object.
* @api
*/
export function getUid(obj) {
return obj.ol_uid || (obj.ol_uid = ++uidCounter_);