matchesWhen
functionsignature
matchesWhen<EM>(when, event): booleanChecks if an event matches a When matcher.
Type parameters
| Name | Type | Description |
|---|---|---|
EM | extends EventMapBase |
Parameters
| Name | Type | Description |
|---|---|---|
when | undefined | When<EM> | The When matcher (or undefined for "all events"). |
| Name | Type | Description |
|---|---|---|
event | Pick<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);
});