aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/channels.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/api/channels.md b/api/channels.md
index dbb6707a..ca7ce17e 100644
--- a/api/channels.md
+++ b/api/channels.md
@@ -93,6 +93,32 @@ The item removed from the channel.
**Example:**
```markdown
+>> channel:peek()
+= "Hello"
+```
+
+---
+
+### `peek`
+
+**Description:**
+Returns the next item that will come out of the channel, but without removing
+it. If the channel is empty, it waits until an item is available.
+
+**Usage:**
+```markdown
+peek(channel:|T|) -> T
+```
+
+**Parameters:**
+
+- `channel`: The channel from which to remove an item.
+
+**Returns:**
+The item removed from the channel.
+
+**Example:**
+```markdown
>> channel:get()
= "Hello"
```