diff --git a/ModuleServerAPI.md b/ModuleServerAPI.md index b22deeb..9837444 100644 --- a/ModuleServerAPI.md +++ b/ModuleServerAPI.md @@ -301,10 +301,41 @@ api.hasReferenceProperty(sceneId, propertyId); ### sendToModule +Send a message to another module within the channel. + +```javascript +api.sendToModule(moduleId, header, ...args); +``` + +| Argument | Type | Description | +| -------- | ------ | -------------------------------------------- | +| module | string | The id of the module to send the message to. | +| header | string | The header of the message. | +| args | any[] | Additional arguments of the message. | + ### receiveFromModule +Receive a message from another module within the channel. + +```javascript +api.receiveFromModule(header, callback); +``` + +| Argument | Type | Description | +| -------- | --------------------------------------- | ----------------------------------------- | +| header | string | The header of the messages to listen for. | +| callback | ( moduleId:string, ...args:any[] ):void | Callback when a message is received. | + ### getChannelModules +Get all modules within the channel. + +```javascript +api.getChannelModules(); +``` + +**Returns** {moduleId:string, type:string, name:string, moduleCommunicationHeaders:{header:string, arguments:number}}[] _List of all modules_ + ### hasChannelModules ## Cues