TinyBase logoTinyBase

addHasIndexListener

The addHasIndexListener method registers a listener function with the Indexes object that will be called whenever an Index definition is added or removed.

addHasIndexListener(
  indexId: IdOrNull,
  listener: HasIndexListener,
): string
TypeDescription
indexIdIdOrNull

The Id of the Index to listen to, or null as a wildcard.

listenerHasIndexListener

The function that will be called whenever the Index is added or removed.

returnsstring

A unique Id for the listener that can later be used to remove it.

You can either listen to a single Index (by specifying the Index Id as the method's first parameter), or changes to any Index (by providing a null wildcard).

The provided listener is a HasIndexListener function, and will be called with a reference to the Indexes object, the Id of the Index that changed, and whether it now exists.

Since

v9.1.0