@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
39 lines (35 loc) • 569 B
JavaScript
/**
* Base class that implements reference counting for objects.
*
* @ignore
*/
class RefCountedObject {
constructor() {
/**
* @type {number}
* @private
*/
this._refCount = 0;
}
/**
* Increments the reference counter.
*/
incRefCount() {
this._refCount++;
}
/**
* Decrements the reference counter.
*/
decRefCount() {
this._refCount--;
}
/**
* The current reference count.
*
* @type {number}
*/
get refCount() {
return this._refCount;
}
}
export { RefCountedObject };