Started on new specs

2025-08-09 16:33:38 +02:00
parent bdcaa7ec1c
commit 0f5b5a9dc1
2 changed files with 53 additions and 44 deletions

@@ -2,36 +2,7 @@
Class representing the ModuleClientAPI. Class representing the ModuleClientAPI.
<!-- ## Overiew ## Communication
Communication
* [send](./ModuleClientAPI#send)
* [on](./ModuleClientAPI#on)
* [finishClientCondition](./ModuleClientAPI#finishclientcondition)
Events
* [onPropertyUpdate](./ModuleClientAPI#onpropertyupdate)
* [onUserDetailsChange](./ModuleClientAPI#onuserdetailschange)
* [onResize](./ModuleClientAPI#onresize)
Module
* [dom](./ModuleClientAPI#dom)
* [getResolution](./ModuleClientAPI#getresolution)
Environment
* [redirect](./ModuleClientAPI#redirect)
* [getUser](./ModuleClientAPI#getuser)
Globals
* [Feedback](./ModuleClientAPI#feedback-notifications-dialogs-confirms-alerts)
* [ce (Create Element)](./ModuleClientAPI#ce)
* [loading](./ModuleClientAPI#loading)
* [hideLoading](./ModuleClientAPI#hideloading)
* [*CHANNEL*](./ModuleClientAPI#const-channel)
* [*ID*](./ModuleClientAPI#const-id)
* [*DISPLAY*](./ModuleClientAPI#const-display) -->
## Functions
### send ### send
@@ -71,6 +42,8 @@ api.finishClientCondition(conditionId);
| ----------- | ------ | ------------------------ | | ----------- | ------ | ------------------------ |
| conditionId | string | The id of the condition. | | conditionId | string | The id of the condition. |
## Events
### onPropertyUpdate ### onPropertyUpdate
Register a listener for when a property updates in a scene change. Register a listener for when a property updates in a scene change.
@@ -108,6 +81,8 @@ api.onResize(callback);
| -------- | -------- | -------------------------------------------------------- | | -------- | -------- | -------------------------------------------------------- |
| callback | function | Function that will be called when the module is resized. | | callback | function | Function that will be called when the module is resized. |
## Getters
### dom ### dom
Get the HTMLDivElement that contains the module HTML. It is important that all your query's to the document are based of this. So you need to use `api.dom().querySeletor(p)` instead of `document.querySeletor(p)` to prevent querying element from another module. Get the HTMLDivElement that contains the module HTML. It is important that all your query's to the document are based of this. So you need to use `api.dom().querySeletor(p)` instead of `document.querySeletor(p)` to prevent querying element from another module.
@@ -118,6 +93,18 @@ api.dom();
**Returns** HTMLDivElement _The module container_ **Returns** HTMLDivElement _The module container_
### getUser
Get the current user object.
```javascript
api.getUser();
```
**Return** [User](./ModuleClientAPIUser) _The user object_
### getModuleID **(TODO)**
### getResolution ### getResolution
Get the scene resolution. Get the scene resolution.
@@ -128,6 +115,38 @@ api.getResolution();
**Returns** { width:number, height:number } _Resolution of scene_ **Returns** { width:number, height:number } _Resolution of scene_
### getTime **(TODO)**
### isInEditor **(TODO)**
## Snapshots
### onSnapshotRestore **(TODO)**
### onSnapshotCreate **(TODO)**
### getRuntimeStorage **(TODO)**
## Playback
### onPlayStateChange **(TODO)**
### onVolumeChange **(TODO)**
### onAudioAllowed **(TODO)**
### getVolume **(TODO)**
### getPlayState **(TODO)**
## Neighbors
### getNeighbors **(TODO)**
### onNeighborMessage **(TODO)**
## Utils
### redirect ### redirect
Redirect user to another url. If the url is a channel on the same server and target is `self` it will redirect internally. Redirect user to another url. If the url is a channel on the same server and target is `self` it will redirect internally.
@@ -141,16 +160,6 @@ api.redirect(address target)
| address | string | The new address to redirect to | | address | string | The new address to redirect to |
| target | 'self' | 'blank' | 'parent' | The target to open the page in. | | target | 'self' | 'blank' | 'parent' | The target to open the page in. |
### getUser
Get the current user object.
```javascript
api.getUser();
```
**Return** [User](./ModuleClientAPIUser) _The user object_
## Globals ## Globals
### Feedback (notifications, dialogs, confirms, alerts) ### Feedback (notifications, dialogs, confirms, alerts)

@@ -57,12 +57,12 @@ client.getDisplayID();
\*_Returns_ string _Display ID_ \*_Returns_ string _Display ID_
### getUserID ### getClientID
Get the user id. Get the client id.
```javascript ```javascript
client.getUserID(); client.getClientID();
``` ```
\*_Returns_ string _User ID_ \*_Returns_ string _Client ID_