Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/soyleninjs/hequalizer/llms.txt

Use this file to discover all available pages before exploring further.

Hequalizer maintains a static registry of all live instances so that any piece of code — event handlers, third-party scripts, framework lifecycle hooks — can retrieve an instance by its handle without needing to hold a direct reference to the object that was originally created.

Hequalizer.instances

A static Map that stores every active Hequalizer instance, keyed by handle string. The map is populated automatically by the constructor and cleaned automatically by destroy(). You rarely need to interact with it directly — getInstance() is the recommended interface.
// The map is available on the class itself
console.log(Hequalizer.instances); // Map(2) { 'card-title' => Hequalizer, 'product-desc' => Hequalizer }

// Iterate all live instances
Hequalizer.instances.forEach((instance, handle) => {
  console.log(handle, instance.values);
});

Hequalizer.getInstance(handle)

Returns the active Hequalizer instance registered under the given handle, or undefined if no instance with that handle currently exists. Signature: Hequalizer.getInstance(handle: string): Hequalizer | undefined Internally, this is a thin wrapper around Hequalizer.instances.get(handle).
getInstance() is especially useful in event handlers, callback functions, or third-party scripts where you don’t have a direct reference to the instance variable. Instead of threading the object through closures or global variables, just call Hequalizer.getInstance('your-handle') from anywhere after the instance has been constructed.

Examples

const titles = new Hequalizer('card-title');

// From anywhere else in your codebase
const sameInstance = Hequalizer.getInstance('card-title');
console.log(sameInstance === titles); // true
getInstance() returns undefined — not null — when the handle is not found. Check for undefined or use optional chaining (?.) to guard against calling methods on a missing instance.

Build docs developers (and LLMs) love