ReplayControls
Controls for a replay. This is the object that a Replay
Methods
interrupt
interrupt(key: string): Promise<unknown>;
Interrupts the current replay and record this event in the replay logs. The replay will finish with an Interrupted result.
Use Replayinterrupt
will resolve with the supplied value.
You also need to pass a key that identifies this type of interrupt. It is stored in the replay state and will be collated with the key that is passed to interrupt
during the repeated call. If the two keys do not match, this means that a bad replay was detected and an error will be thrown. You should discard the replay state and restart the replay from scratch.
cancel
cancel(message?: unknown): Promise<never>;
Cancels the replay. This tells the replay engine that a supplied interrupt value should be rejected. The replay will finish with a Canceled result.
A message object can be passed to cancel
. This can be used to communicate to the caller why the interrupt value was rejected.
action
Performs an action.
Actions are a way to signal to the replay engine that a particular piece of code should not be run repeatedly. The result of the action will be stored in the underlying replay log. During a subsequent replay, the action will not be repeated. Instead, the return is taken from the replay log.
You also need to pass a key that identifies this type of action. It is stored in the replay state and will be collated with the key that is passed to action
during the repeated call. If the two keys do not match, this means that a bad replay was detected and an error will be thrown. You should discard the replay state and restart the replay from scratch.
checkpoint
checkpoint(): Checkpoint;
Creates a checkpoint at the current position of the replay. This can be passed to Replay