Added neighbor results

2025-08-10 17:32:28 +02:00
parent aeaeaf1ec4
commit 3ed8cc0445

@@ -1,3 +1,98 @@
# ModuleClientApi - Neighbor Results # ModuleClientApi - Neighbor Results
Class representing a group of Neighbors of the ModuleClientAPI User. 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._