Function
on
(
type: T,
handler: (event: Extract<Event, { type: T }>, metadata: EventMetadata) => void,
)
Source from the content-addressed store, hash-verified
| 20 | } |
| 21 | |
| 22 | function on<T extends Event["type"]>( |
| 23 | type: T, |
| 24 | handler: (event: Extract<Event, { type: T }>, metadata: EventMetadata) => void, |
| 25 | ) { |
| 26 | return subscribe((event: Event, metadata: EventMetadata) => { |
| 27 | if (event.type !== type) return |
| 28 | handler(event as Extract<Event, { type: T }>, metadata) |
| 29 | }) |
| 30 | } |
| 31 | |
| 32 | return { |
| 33 | subscribe, |
Callers
nothing calls this directly
Tested by
no test coverage detected