Channel Targets
Overview
This section contains all components and utilities for Channel Targets.
Components
| Item | Type | Description |
|---|---|---|
| this.channelTargets (ChannelTargetsAPI) | Class | Reads the apps, devices, and system features selected for Dot X channels. |
| ChannelTarget | Unknown | Channel target entries are the apps, devices, and system features selected |
| for a Dot X channel. | ||
| ChannelTargetsAllResponse | Interface | Response returned when reading every stored channel's targets. |
| ChannelTargetsByChannel | Unknown | Channel target entries keyed by channel ID. |
| ChannelTargetsForChannelResponse | Interface | Response returned when reading one channel's targets. |
this.channelTargets (ChannelTargetsAPI)
Reads the apps, devices, and system features selected for Dot X channels.
Access this API via this.channelTargets in your plugin class.
Example
export default class MyPlugin extends Plugin {
async onLoad() {
const channelZero = await this.channelTargets.getForChannel(0);
console.log('Channel 0 targets:', channelZero.targets);
const allChannels = await this.channelTargets.getAll();
console.log('All channel targets:', allChannels.channels);
}
}Methods
| Method | Parameters | Description |
|---|---|---|
getAll() | - | Gets the apps, devices, and system features selected for every stored channel.. |
getForChannel() | channel: string | number | Gets the apps, devices, and system features selected for one channel. |
getAll()
getAll(): PromiseGets the apps, devices, and system features selected for every stored channel.
Returns:
Promise - Promise that resolves to all stored channel targets keyed by channel ID.
Example:
const { channels } = await this.channelTargets.getAll();
for (const [channel, targets] of Object.entries(channels)) {
console.log(channel, targets);
}getForChannel()
getForChannel(channel: string \| number): PromiseGets the apps, devices, and system features selected for one channel.
Unassigned channels return an empty targets array.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
channel | string \| number | Yes | Channel ID to read. |
Returns:
Promise - Promise that resolves to the channel ID and selected targets.
Example:
const { channel, targets } = await this.channelTargets.getForChannel(0);
console.log(`Channel ${channel}:`, targets);ChannelTarget
Channel target entries are the apps, devices, and system features selected for a Dot X channel.
ChannelTargetsAllResponse
Response returned when reading every stored channel's targets.
Properties
- channels (ChannelTargetsByChannel): Selected targets keyed by channel ID.
ChannelTargetsByChannel
Channel target entries keyed by channel ID.
ChannelTargetsForChannelResponse
Response returned when reading one channel's targets.
Properties
- channel (string): Channel ID as stored by Dot X.
- targets (string[]): Apps, devices, and system features selected for the channel.