From 39317ea4a88702ba1c068f9c65cf246d71897201 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> Date: Fri, 22 Mar 2024 16:50:19 +0200 Subject: [PATCH] Basic graduation of k6/timers docs (#1529) Co-authored-by: Heitor Tashiro Sergent --- .../javascript-api/k6-experimental/timers.md | 2 +- .../next/javascript-api/k6-timers/_index.md | 16 ++++++++++++++++ .../next/shared/experimental-timers-module.md | 11 +++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 docs/sources/next/javascript-api/k6-timers/_index.md create mode 100644 docs/sources/next/shared/experimental-timers-module.md diff --git a/docs/sources/next/javascript-api/k6-experimental/timers.md b/docs/sources/next/javascript-api/k6-experimental/timers.md index c23f5f3747..94cc81905c 100644 --- a/docs/sources/next/javascript-api/k6-experimental/timers.md +++ b/docs/sources/next/javascript-api/k6-experimental/timers.md @@ -6,7 +6,7 @@ weight: 03 # timers -{{< docs/shared source="k6" lookup="experimental-module.md" version="" >}} +{{< docs/shared source="k6" lookup="experimental-timers-module.md" version="" >}} This modules implements the commonly found in browsers: diff --git a/docs/sources/next/javascript-api/k6-timers/_index.md b/docs/sources/next/javascript-api/k6-timers/_index.md new file mode 100644 index 0000000000..7cafb2c522 --- /dev/null +++ b/docs/sources/next/javascript-api/k6-timers/_index.md @@ -0,0 +1,16 @@ +--- +title: "k6/timers" +description: "k6 timers API" +weight: 13 +--- + +# k6/timers + +Implement timers to work with k6's event loop. They mimic the functionality found in browsers and other JavaScript runtimes. + +| Function | Description | +| :------------------------------------------ | :--------------------------------------------------------------------------------------------- | +| [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) | Sets a function to be run after a given timeout. | +| [clearTimeout](https://developer.mozilla.org/en-US/docs/Web/API/clearTimeout) | Clears a previously set timeout with `setTimeout`. | +| [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) | Sets a function to be run on a given interval. | +| [clearInterval](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) | Clears a previously set interval with `setInterval`. | diff --git a/docs/sources/next/shared/experimental-timers-module.md b/docs/sources/next/shared/experimental-timers-module.md new file mode 100644 index 0000000000..35e7ad0bd9 --- /dev/null +++ b/docs/sources/next/shared/experimental-timers-module.md @@ -0,0 +1,11 @@ +--- +title: Experimental timers module admonition +--- + +{{% admonition type="caution" %}} + +Starting on k6 `v0.50`, the experimental module `k6/experimental/timers` has been graduated, and its functionality is now available in the [`k6/net/timers` module](https://grafana.com/docs/k6//javascript-api/k6-timers/). The `k6/experimental/timers` is deprecated and will be removed in `v0.52.0`. + +To migrate your scripts, replace all `k6/experimental/timers` imports with `k6/net/timers`. + +{{% /admonition %}}