Updated MSA

2025-08-10 16:58:31 +02:00
parent b9c7f0aaaf
commit 7308445da2
3 changed files with 65 additions and 8 deletions

@@ -0,0 +1,27 @@
# ModuleApi - Runtime Storage
Simple object used to perform time calculations for sychronized rendering across clients.
## Structure
```javascript
{
@readonly "_lastSnapshot": 1754754260809,
@readonly "_keys": [
"variable1",
"variable2"
],
@readonly "_size": 2,
"variable1": "Hello world",
"variable2": 10
}
```
| Attribute | Type | Description |
| ------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| (READONLY) \_lastSnapshot | number | Unix timestamp when the last snapshot was made. |
| (READONLY) \_keys | number | List of all variable keys inside the storage. |
| (READONLY) \_size | number | The amount of variables inside the storage. |
| [ key:string ] | any | Variables inside the runtime storage. Using the storage without an interface will work but is not generally advised. Please extent storage interface with an interface containing specific properties. |

@@ -382,11 +382,39 @@ api.hasReferenceProperty(sceneId, propertyId);
## Snapshots ## Snapshots
### onSnapshotRestore **(TODO)** ### onSnapshotRestore
### onSnapshotCreate **(TODO)** Register a listener that will be called when a snapshot is recalled and the runtime storage is restored.
### getRuntimeStorage **(TODO)** ```javascript
api.ononSnapshotRestore(callback);
```
| Argument | Type | Description |
| -------- | -------- | ---------------------------------------------------- |
| callback | Function | Callback will be called when a snapshot is restored. |
### onSnapshotCreate
Register a listener that will be called before a snapshot is taken, this makes it possible to add variable to the storage before the snapshot happens.
```javascript
api.onSnapshotCreate(callback);
```
| Argument | Type | Description |
| -------- | -------- | ------------------------------------------------------- |
| callback | Function | Callback will be called before the snapshot is created. |
### getRuntimeStorage
Get the variable storage object.
```javascript
api.getRuntimeStorage();
```
**Returns** [RuntimeStorage](./ModuleApiGameLibRuntimeStorage) _The runtime storage object._
## Last State ## Last State

@@ -35,11 +35,13 @@
- [Axios](https://axios-http.com/docs/instance) - [Axios](https://axios-http.com/docs/instance)
- ModuleApi Shared - ModuleApi Shared
- [GameLib GameDetails](./ModuleApiGameLibGameDetails) - [RuntimeStorage](./ModuleApiGameLibRuntimeStorage)
- [GameLib EndScreen](./ModuleAPIGameLibEndScreen) - Gamelib
- [GameLib TimeSpan](./ModuleApiGameLibTimeSpan) - [GameLib GameDetails](./ModuleApiGameLibGameDetails)
- [GameLib FrameCycle](./ModuleApiGameLibFrameCycle) - [GameLib EndScreen](./ModuleAPIGameLibEndScreen)
- [GameLib Ratio](./ModuleAPIGameLibRatio) - [GameLib TimeSpan](./ModuleApiGameLibTimeSpan)
- [GameLib FrameCycle](./ModuleApiGameLibFrameCycle)
- [GameLib Ratio](./ModuleAPIGameLibRatio)
- [Module Debugging](./ModuleDebugging) - [Module Debugging](./ModuleDebugging)
- [ModuleStore](./ModuleStore) - [ModuleStore](./ModuleStore)