getInstances
Returns all mounted instances of every component. Pass a component constructor as the first parameter to get instances for a specific component only.
Usage
js
import { Base, getInstances } from '@studiometa/js-toolkit';
import Component from './Component.js';
// Get all mounted instances of all components
const instances = getInstances(); // Set<Base>
// Get all mounted instances of the `Component` component
getInstances(Component); // Set<Component>Parameters
ctor(undefined | typeof Base): the class from which the instances should be retrieved
Return value
Set<Base>: all the instances created with the given class