-
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
1.1 api simple #154
1.1 api simple #154
Conversation
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.
I really like this simplification. It makes the API a lot simpler to understand and use. Well done!
Added a few minor improvements that can be made.
thanks @rikoe! I've made the recommended changes and pushed to my branch |
* `Error` with a string from the `ChannelError` enumeration. | ||
*/ | ||
joinChannel(channelId: string) : Promise<void>; |
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.
All other channel interactions happen through the Channel
object, and for consistency it feels like this one should too.
Can this method be moved to Channel.join(): Promise<void>
?
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.
I think the reason is that if it is at the top level you could just join a channel by id without having to do a “get and search” first, so it massively simplifies the code for someone who just wants to join a channel and then use the existing top-level broadcast or context listener.
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.
Yes, exactly.
* Channels may be visualized and selectable by users. DisplayMetaData may be used to provide hints on how to see them. | ||
* For app channels, displayMetadata would typically not be present | ||
*/ | ||
displayMetadata?: DisplayMetadata; |
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.
Add public readonly
modifiers?
Also, comment refers to "DisplayMetaData", should be "DisplayMetadata".
|
||
try { | ||
let myChannel = await fdc3.getOrCreateChannel("myChannel"); | ||
myChannel.addContextListener(listener); |
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.
This is not correct. Should be: const listener = myChannel.addContextListener(context => { })
The purpose of this pull request is the following: