La referencia de la API está disponible solo en inglés por ahora.

matchesWhen

function
store/matching.ts:54
signature
matchesWhen<EM>(when, event): boolean

Checks if an event matches a When matcher.

Type parameters

NameTypeDescription
EMextends EventMapBase

Parameters

NameTypeDescription
whenundefined | When<EM>The When matcher (or undefined for "all events").
NameTypeDescription
eventPick<EventUnion<EM>, "channel" | "type">The event to check.

Returns

boolean, true if the event matches, false otherwise.

Example

example
store.instrument((info) => {
  if (matchesWhen({ channels: ["orders", "billing"] }, info.event)) record(info);
});