MCPcopy Create free account
hub / github.com/TanStack/db / getHandlerForEvent

Function getHandlerForEvent

packages/db/src/query/effect.ts:1008–1020  ·  view source on GitHub ↗
(
  event: DeltaEvent<TRow, TKey>,
  config: EffectConfig<TRow, TKey>,
)

Source from the content-addressed store, hash-verified

1006// ---------------------------------------------------------------------------
1007
1008function getHandlerForEvent<TRow extends object, TKey extends string | number>(
1009 event: DeltaEvent<TRow, TKey>,
1010 config: EffectConfig<TRow, TKey>,
1011): EffectEventHandler<TRow, TKey> | undefined {
1012 switch (event.type) {
1013 case `enter`:
1014 return config.onEnter
1015 case `exit`:
1016 return config.onExit
1017 case `update`:
1018 return config.onUpdate
1019 }
1020}
1021
1022/**
1023 * Accumulate D2 output multiplicities into per-key effect changes.

Callers 1

onBatchProcessedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected