Skip to content

Commit 98cd778

Browse files
authored
🤖 Merge PR DefinitelyTyped#70139 [@types/cloudflare-turnstile] Add "execution" to cloudflare turnstile render params by @pkong-ds
1 parent 36cf1bd commit 98cd778

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

‎types/cloudflare-turnstile/cloudflare-turnstile-tests.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ const refreshTimeoutNever: Turnstile.RefreshTimeoutMode = "never";
3535
const refreshTimeoutManual: Turnstile.RefreshTimeoutMode = "manual";
3636
const refreshTimeoutAuto: Turnstile.RefreshTimeoutMode = "auto";
3737

38+
const executionRender: Turnstile.ExecutionMode = "render";
39+
const executionExecute: Turnstile.ExecutionMode = "execute";
40+
3841
// @ts-expect-error
3942
turnstile.ready();
4043
// $ExpectType void

‎types/cloudflare-turnstile/index.d.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ declare namespace Turnstile {
8787
*/
8888
type RefreshTimeoutMode = "never" | "manual" | "auto";
8989

90+
/**
91+
* The execution mode to controls when to obtain the widget token
92+
* The default is "render". "render" will make the challenge runs automatically after calling the render() function, while
93+
* "execute" will make the challenge runs after the render() function has been called, by invoking the turnstile.execute function separately.
94+
* This detaches the appearance and rendering of a widget from its execution.
95+
*/
96+
type ExecutionMode = "render" | "execute";
97+
9098
/**
9199
* Parameters for the turnstile.render() method.
92100
*/
@@ -219,5 +227,12 @@ declare namespace Turnstile {
219227
* @default "auto"
220228
*/
221229
"refresh-timeout"?: RefreshTimeoutMode | undefined;
230+
231+
/**
232+
* Optional
233+
* @see ExecutionMode
234+
* @default "render"
235+
*/
236+
execution?: ExecutionMode | undefined;
222237
}
223238
}

0 commit comments

Comments
 (0)