UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

54 lines (51 loc) 1.59 kB
'use strict'; "use strict"; const GlobalResourceRegistry = { /** * Set of registered pools and cleanable objects. * @private */ _registeredResources: /* @__PURE__ */ new Set(), /** * Registers a pool or cleanable object for cleanup. * @param {Cleanable} pool - The pool or object to register. */ register(pool) { this._registeredResources.add(pool); }, /** * Unregisters a pool or cleanable object from cleanup. * @param {Cleanable} pool - The pool or object to unregister. */ unregister(pool) { this._registeredResources.delete(pool); }, /** Clears all registered pools and cleanable objects. This will call clear() on each registered item. */ release() { this._registeredResources.forEach((pool) => pool.clear()); }, /** * Gets the number of registered pools and cleanable objects. * @returns {number} The count of registered items. */ get registeredCount() { return this._registeredResources.size; }, /** * Checks if a specific pool or cleanable object is registered. * @param {Cleanable} pool - The pool or object to check. * @returns {boolean} True if the item is registered, false otherwise. */ isRegistered(pool) { return this._registeredResources.has(pool); }, /** * Removes all registrations without clearing the pools. * Useful if you want to reset the collector without affecting the pools. */ reset() { this._registeredResources.clear(); } }; exports.GlobalResourceRegistry = GlobalResourceRegistry; //# sourceMappingURL=GlobalResourceRegistry.js.map