diff --git a/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts b/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts index 2435fd166..ce88e25e4 100644 --- a/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts +++ b/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts @@ -32,7 +32,7 @@ export class DefaultChannelSupport implements ChannelSupport { constructor(messaging: Messaging, channelSelector: ChannelSelector) { this.messaging = messaging; this.channelSelector = channelSelector - this.channelSelector.setChannelChangeCallback((channelId: string) => { + this.channelSelector.setChannelChangeCallback((channelId: string | null) => { if (channelId == null) { this.leaveUserChannel() } else { diff --git a/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts b/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts index 618d63764..e4a45ba83 100644 --- a/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts +++ b/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts @@ -14,7 +14,7 @@ type IframeChannelSelected = BrowserTypes.IframeChannelSelected */ export class DefaultDesktopAgentChannelSelector extends AbstractUIComponent implements ChannelSelector { - private callback: ((channelId: string) => void) | null = null + private callback: ((channelId: string | null) => void) | null = null constructor(url: string | null) { super(url ?? "https://fdc3.finos.org/webui/channel_selector.html", "FDC3 Channel Selector") @@ -27,7 +27,7 @@ export class DefaultDesktopAgentChannelSelector extends AbstractUIComponent impl port.addEventListener("message", (e) => { if (e.data.type == 'iframeChannelSelected') { const choice = e.data as IframeChannelSelected - if ((choice.payload.selected) && (this.callback)) { + if (this.callback) { this.callback(choice.payload.selected) } } @@ -51,7 +51,7 @@ export class DefaultDesktopAgentChannelSelector extends AbstractUIComponent impl } as IframeChannels) } - setChannelChangeCallback(callback: (channelId: string) => void): void { + setChannelChangeCallback(callback: (channelId: string | null) => void): void { this.callback = callback } diff --git a/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts b/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts index 11dc9cb20..33e61cd72 100644 --- a/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts +++ b/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts @@ -13,7 +13,7 @@ export class NullChannelSelector implements ChannelSelector, Connectable { updateChannel(_channelId: string | null, _availableChannels: Channel[]): void { } - setChannelChangeCallback(_callback: (channelId: string) => void): void { + setChannelChangeCallback(_callback: (channelId: string | null) => void): void { } diff --git a/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts b/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts index 97dd30a02..08c2e22b5 100644 --- a/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts +++ b/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts @@ -8,7 +8,7 @@ import { CustomWorld } from "../world"; Given('A Channel Selector in {string} with callback piping to {string}', async function (this: CustomWorld, field: string, cb: string) { const cs = new DefaultDesktopAgentChannelSelector(CHANNEL_SELECTOR_URL); - cs.setChannelChangeCallback((channelId: string) => { + cs.setChannelChangeCallback((channelId: string | null) => { this.props[cb] = channelId }) diff --git a/packages/fdc3-standard/src/ui/ChannelSelector.ts b/packages/fdc3-standard/src/ui/ChannelSelector.ts index 7d509e6c9..61c23b541 100644 --- a/packages/fdc3-standard/src/ui/ChannelSelector.ts +++ b/packages/fdc3-standard/src/ui/ChannelSelector.ts @@ -15,6 +15,6 @@ export interface ChannelSelector extends Connectable { * Called on initialisation. The channel selector will invoke the callback after the * channel is changed. */ - setChannelChangeCallback(callback: (channelId: string) => void): void + setChannelChangeCallback(callback: (channelId: string | null) => void): void } diff --git a/packages/testing/src/agent/index.ts b/packages/testing/src/agent/index.ts index d58d587fb..e299672d1 100644 --- a/packages/testing/src/agent/index.ts +++ b/packages/testing/src/agent/index.ts @@ -59,7 +59,7 @@ export class SimpleChannelSelector implements ChannelSelector { this.cw.props['channels'] = availableChannels } - setChannelChangeCallback(_callback: (channelId: string) => void): void { + setChannelChangeCallback(_callback: (channelId: string | null) => void): void { } async connect(): Promise {