Communicator
The communicator is the means by which the Javascript Adaptor talks to Sketchup
Out of the box there are 2 supported communication channels.
- Communication via iFrame post message (when an iFrame is detected)
- Communication via the window.sketchup object (when launched from Desktop or a Ruby extension)
Implements
Section titled “Implements”TenantParent
Constructor
Section titled “Constructor”Constructor
Section titled “Constructor”new Communicator(
options,tenants):Communicator
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Section titled “Returns”Communicator
Methods
Section titled “Methods”debug()
Section titled “debug()”debug(…
args):void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
… |
|
Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”
abstractdestroy():void
Should remove any bindings and destroy this communicator
Returns
Section titled “Returns”void
registerChannel()
Section titled “registerChannel()”
abstractregisterChannel(channelName,consumer):void
Registers a channel name and a function to consume data from that channel
This is called internally by the bootstrapping mechanism
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
the channel to register |
|
|
( |
the consumer |
Returns
Section titled “Returns”void
registerTenantIFrame()
Section titled “registerTenantIFrame()”registerTenantIFrame(
options):void
Registers a tenant to this communicator. This allows child iFrames to use the JSA directly
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
the tenant options |
Returns
Section titled “Returns”void
removeChannel()
Section titled “removeChannel()”
abstractremoveChannel(channelName):void
Removes a channel by name. Called during disconnection to ensure that there are no dangling callback executions
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
the channel to remove |
Returns
Section titled “Returns”void
removeTenant()
Section titled “removeTenant()”removeTenant(
tenant):void
Removes the tenant from this communicator
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
the tenant |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”TenantParent.removeTenant
sendOnChannel()
Section titled “sendOnChannel()”
abstractsendOnChannel(channelName,data,tenantID?):void
Sends a message on a given channel
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
the name of the channel |
|
|
|
the data that should be sent |
|
|
|
the ID of the tenant (if any) |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”TenantParent.sendOnChannel
updateOptions()
Section titled “updateOptions()”updateOptions(
options):void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”void