Skip to content

Channel Targets ​

Overview ​

This section contains all components and utilities for Channel Targets.

Components ​

ItemTypeDescription
this.channelTargets (ChannelTargetsAPI)ClassReads the apps, devices, and system features selected for Dot X channels.
ChannelTargetUnknownChannel target entries are the apps, devices, and system features selected
for a Dot X channel.
ChannelTargetsAllResponseInterfaceResponse returned when reading every stored channel's targets.
ChannelTargetsByChannelUnknownChannel target entries keyed by channel ID.
ChannelTargetsForChannelResponseInterfaceResponse 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 ​

typescript
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 ​

MethodParametersDescription
getAll()-Gets the apps, devices, and system features selected for every stored channel..
getForChannel()channel: string | numberGets the apps, devices, and system features selected for one channel.

getAll() ​

typescript
getAll(): Promise

Gets 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:

typescript
const { channels } = await this.channelTargets.getAll();
for (const [channel, targets] of Object.entries(channels)) {
  console.log(channel, targets);
}

getForChannel() ​

typescript
getForChannel(channel: string \| number): Promise

Gets the apps, devices, and system features selected for one channel.

Unassigned channels return an empty targets array.

Parameters:

NameTypeRequiredDescription
channelstring \| numberYesChannel ID to read.

Returns:

Promise - Promise that resolves to the channel ID and selected targets.

Example:

typescript
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.