From 3ed8cc0445a05aee5375901ceaefd53fe704f265 Mon Sep 17 00:00:00 2001 From: Mees van der Wijk Date: Sun, 10 Aug 2025 17:32:28 +0200 Subject: [PATCH] Added neighbor results --- ModuleClientAPINeighborResults.md | 95 +++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/ModuleClientAPINeighborResults.md b/ModuleClientAPINeighborResults.md index fd923aa..f33a18d 100644 --- a/ModuleClientAPINeighborResults.md +++ b/ModuleClientAPINeighborResults.md @@ -1,3 +1,98 @@ # ModuleClientApi - Neighbor Results Class representing a group of Neighbors of the ModuleClientAPI User. + +## Methods + +### sendToAll + +Send a packet to all neighbors in the result result. + +```javascript +NeighborResults.sendToAll(header, ...args); +``` + +| Argument | Type | Description | +| -------- | ------ | -------------------------- | +| header | string | The header of the message. | +| args | any[] | Data of any type. | + +### forEach + +Loop trough all neighbors in this result. + +```javascript +NeighborResults.forEach(callback); +``` + +| Argument | Type | Description | +| -------- | ---------------------------------------------- | -------------------------------------------------- | +| callback | ( [Neighbor](./ModuleClientAPINeighbor) ):void | Handler thats called for every neighbor in result. | + +### getAll + +Get all neighbors in this result. + +```javascript +NeighborResults.getAll(); +``` + +**Returns** [Neighbor](./ModuleClientAPINeighbor)[] _Neighbors in result._ + +### get + +Get a neighbors in this result. + +```javascript +NeighborResults.get(index); +``` + +| Argument | Type | Description | +| -------- | ------ | ----------------------------------------- | +| index | number | The index of the neighbor in this result. | + +**Returns** [Neighbor](./ModuleClientAPINeighbor) _Neighbor instance._ + +### first + +Get the first neighbors in this result. + +```javascript +NeighborResults.first(); +``` + +**Returns** [Neighbor](./ModuleClientAPINeighbor) _Neighbor instance._ + +### last + +Get the last neighbors in this result. + +```javascript +NeighborResults.last(); +``` + +**Returns** [Neighbor](./ModuleClientAPINeighbor) _Neighbor instance._ + +## Attributes + +### length + +Amount of neighbors in the result. + +```javascript +NeighborResults.length; +``` + +### [index] + +Get a neighbor at a specific index + +```javascript +NeighborResults[index]; +``` + +| Argument | Type | Description | +| -------- | ------ | ----------------------------------------- | +| index | number | The index of the neighbor in this result. | + +**Returns** [Neighbor](./ModuleClientAPINeighbor) _Neighbor instance._