Skip to content

CountMap

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/scenery/blob/main/js/util/CountMap.js for the most up-to-date information.

Overview

Data structure that handles creating/destroying related objects that need to exist when something's count is >=1

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class CountMap

import { CountMap } from 'scenerystack/scenery';

Constructor

new CountMap( create, destroy )

Instance Methods

increment( key, quantity )

@public

@param {*} key @param {number} [quantity]

decrement( key, quantity )

@public

@param {*} key @param {number} [quantity]

get( key )

@public

@param {} key @returns {}

clear()

@public

NOTE: We COULD try to collect all of the CountMapEntries... but that seems like an awful lot of CPU. If GC is an issue from this, we can add more logic

Source Code

See the source for CountMap.js in the scenery repository.