Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove documentation for k6/experimental/timers #1723

Merged
merged 5 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/sources/next/javascript-api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ The [`k6/browser` module](https://grafana.com/docs/k6/<K6_VERSION>/javascript-ap

{{< docs/shared source="k6" lookup="javascript-api/k6-net-grpc.md" version="<K6_VERSION>" >}}

## k6/timers

{{< docs/shared source="k6" lookup="javascript-api/k6-timers.md" version="<K6_VERSION>" >}}

## k6/ws

{{< docs/shared source="k6" lookup="javascript-api/k6-ws.md" version="<K6_VERSION>" >}}
Expand Down
18 changes: 0 additions & 18 deletions docs/sources/next/javascript-api/k6-experimental/timers.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ This example shows:
```javascript
import { randomString, randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.1.0/index.js';
import { WebSocket } from 'k6/experimental/websockets';
import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers';

const chatRoomName = 'publicRoom'; // choose any chat room name
const sessionDuration = randomIntBetween(5000, 60000); // user session between 5s and 1m
Expand Down
17 changes: 3 additions & 14 deletions docs/sources/next/javascript-api/k6-timers/_index.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
---
aliases:
- ./k6-experimental/timers # docs/k6/<K6_VERSION>/javascript-api/k6-experimental/timers
title: 'k6/timers'
description: 'k6 timers API'
weight: 11
---

# 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`. |

{{< admonition type="note" >}}

The timer methods are available globally, so you can use them in your script without including an import statement.

{{< /admonition >}}
{{< docs/shared source="k6" lookup="javascript-api/k6-timers.md" version="<K6_VERSION>" >}}

## Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ title: javascript-api/k6-experimental
| [fs](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs) | Provides a memory-efficient way to handle file interactions within your test scripts. |
| [redis](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/redis) | Functionality to interact with [Redis](https://redis.io/). |
| [streams](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/streams) | Provides an implementation of the Streams API specification, offering support for defining and consuming readable streams. |
| [timers](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/timers) | `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` |
| [tracing](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/tracing) | Support for instrumenting HTTP requests with tracing information. |
| [webcrypto](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto) | Implements the [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). |
| [websockets](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/websockets) | Implements the browser's [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). |
18 changes: 18 additions & 0 deletions docs/sources/next/shared/javascript-api/k6-timers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: javascript-api/k6-timers
---

The [`k6/timers` module](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-timers) implements 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`. |

{{< admonition type="note" >}}

The timer methods are available globally, so you can use them in your script without including an import statement.

{{< /admonition >}}
Loading