Problem
When an application registers a listener using either:
desktopAgent.addEventListener("contextCleared", handler);
or:
channel.addEventListener("contextCleared", handler);
the resulting FDC3ContextClearedEvent only identifies the type of context that was cleared:
export interface FDC3ContextClearedEvent extends FDC3Event {
readonly type: "contextCleared";
readonly details: {
contextType: string | null;
};
}
For a listener registered through DesktopAgent.addEventListener, this does not tell the application which channel was cleared. An application may interact with its current User Channel and multiple App Channels, so contextType alone is insufficient to identify the affected channel.
Although a listener registered on a Channel object has an implicit association with that channel, using a different event shape would be inconsistent and would make events harder to handle uniformly.
Note that the Desktop Agent Communication Protocol already includes channelId in the contextClearedEvent payload:
{
"channelId": "channel-id",
"contextType": "fdc3.instrument"
}
So, channelId is not currently part of the standard FDC3ContextClearedEvent interface, but is needed even in the DACP implementation.
Proposed change
Add channelId to FDC3ContextClearedEvent.details:
export interface FDC3ContextClearedEvent extends FDC3Event {
readonly type: "contextCleared";
readonly details: {
channelId: string;
contextType: string | null;
};
}
For the sake of consistency, I would also recommend using the same event shape for both of these:
desktopAgent.addEventListener("contextCleared", handler);
channel.addEventListener("contextCleared", handler);
This means channelId should still be included when the listener was registered on a specific Channel, even though the channel is implicit from the object on which the listener was registered. Keeping the shapes identical:
- allows shared event handlers
- avoids API-specific variants of FDC3ContextClearedEvent
- aligns the standard API with the existing DACP event
- makes the source channel explicit when events are logged, forwarded, or processed asynchronously
Area of Issue
Problem
When an application registers a listener using either:
or:
the resulting
FDC3ContextClearedEventonly identifies the type of context that was cleared:For a listener registered through
DesktopAgent.addEventListener, this does not tell the application which channel was cleared. An application may interact with its current User Channel and multiple App Channels, socontextTypealone is insufficient to identify the affected channel.Although a listener registered on a Channel object has an implicit association with that channel, using a different event shape would be inconsistent and would make events harder to handle uniformly.
Note that the Desktop Agent Communication Protocol already includes
channelIdin thecontextClearedEventpayload:{ "channelId": "channel-id", "contextType": "fdc3.instrument" }So,
channelIdis not currently part of the standardFDC3ContextClearedEventinterface, but is needed even in the DACP implementation.Proposed change
Add
channelIdtoFDC3ContextClearedEvent.details:For the sake of consistency, I would also recommend using the same event shape for both of these:
This means
channelIdshould still be included when the listener was registered on a specificChannel, even though the channel is implicit from the object on which the listener was registered. Keeping the shapes identical:Area of Issue