From a345ecf3c4f7e0759432d07178cce8ff6dd887f3 Mon Sep 17 00:00:00 2001 From: KnorpelSenf Date: Sat, 9 Nov 2024 17:35:25 +0100 Subject: [PATCH] docs: add example for checkpoint and rewind --- src/conversation.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/conversation.ts b/src/conversation.ts index 8794844..4c7a9db 100644 --- a/src/conversation.ts +++ b/src/conversation.ts @@ -336,6 +336,13 @@ First return your data from `external` and then resume update handling using `wa * * This checkpoint can be passed to `rewind` in order to go back in the * conversation and resume it from an earlier point. + * + * ```ts + * const check = conversation.checkpoint(); + * + * // Later: + * await conversation.rewind(check); + * ``` */ checkpoint(): Checkpoint { return this.controls.checkpoint(); @@ -345,6 +352,13 @@ First return your data from `external` and then resume update handling using `wa * there. This point is specified by a checkpoint that can be created by * calling {@link Conversation.checkpoint}. * + * ```ts + * const check = conversation.checkpoint(); + * + * // Later: + * await conversation.rewind(check); + * ``` + * * @param checkpoint A previously created checkpoint */ async rewind(checkpoint: Checkpoint): Promise {