-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add context filtering to API and improve docs #161
Conversation
- Added overloads for addContextListener that include contextType parameter - Added optional contextType parameter to getContextValue - Rename Channel.addBroadcastListener to Channel.addContextListener for consistency - Change signature of channel context listener to match desktop agent one (remove redundant channel parameter) - Introduce ContextHandler shared type for context handlers like addContextListener. - Add documentation for API changes - Move Channel, Listener, DisplayMetadata and ContextHandler to their own pages - Cleanup of markdown docs
1300a8b
to
bab449f
Compare
* `Error` with a string from the `ChannelError` enumeration. | ||
*/ | ||
public broadcast(context: Context): Promise<void>; | ||
|
||
/** | ||
* Returns the last context that was broadcast on this channel. All channels initially have no context, until a | ||
* window is added to the channel and then broadcasts. If there is not yet any context on the channel, this method | ||
* will return `null`. The context is also reset back into it's initial context-less state whenever a channel is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkolba I have removed the second part - seems like an implementation detail to me. FDC3 has no concept of "windows", so it shouldn't be in there.
@@ -102,34 +103,36 @@ declare class Channel { | |||
* Note that this function can be used without first joining the channel, allowing applications to broadcast on | |||
* channels that they aren't a member of. | |||
* | |||
* This broadcast will be received by all windows that are members of this channel, *except* for the window that | |||
* makes the broadcast. This matches the behaviour of the top-level FDC3 `broadcast` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkolba I have removed this part - seems like an implementation detail to me. FDC3 has no concept of "windows", so it shouldn't be in there.
Addresses #121.
A summary of the type changes I introduced:
becomes:
The channel parameter is completely redundant here, as we already now what the channel is from the owning object - if a reference is needed, it can be captured with a closure. This brings the handler in line with the one on the desktop agent, which makes for much easier consumption.
Apart from that I have factored out and improved the relevant documentation sections on the website.