def emit
import bendvy-ecs-core@0.1.0.4/transaction.bend as Transactionimport Base
53# Stage one Data event, retaining publication order for successful commit.
54# Failure publishes none of this transaction's staged events. For affine
55# Type payload ownership/recovery use the separate owned-event APIs.
56def emit(~W: Type, ~E: Data, tx: Tx<W, E>, event: E) -> Tx<W, E>:
57 match tx:
58 case Tx{world, undo, commands, events,trace}:
59 Tx{world, undo, commands, event <> events,trace}