aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-18 23:31:36 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-18 23:31:36 -0400
commit9e07c6adc7a0616eec40e78024a8501ec7d96559 (patch)
tree92542ba27e13152a8305deb6f0cda3a952ac8835 /api
parent1f16d63ac783d9b1bb1d4a65676476d14f0af713 (diff)
Add Channel:peek()
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"
```