Use separate channels for guest / host messages from sidebar
Use separate channels for sending messages to guests vs the host in the sidebar, even for the common case when there is only one guest and it is the same frame as the host. This change makes it clear for readers which part of the annotator code is intended to handle a particular message from the sidebar. It is also a step towards supporting host frames that are not guests. This will be needed in ebook readers where the host frame provides the navigation UI and contains the frame displaying the book content, but should not be annotatble itself. - Remove the `bridge` service in the sidebar. The `frameSync` service now provides the entry point for other services/components to make RPC calls to the host or guest frames. Currently the only use case is sending notifications to the host via `FrameSyncService.notifyHost`. - Create separate `Bridge` instances in `FrameSyncService` for sidebar <-> guest and sidebar <-> host communication. The sidebar <-> guest bridge works the same as before. The sidebar <-> host bridge is established by having `FrameSyncService` create a MessageChannel when sending the `hypothesisSidebarReady` notification to the host. The sidebar / host frames then add respective ports of this channel to a Bridge instance. - Change the various existing RPC calls between frames to use either the guest <-> sidebar or host <-> sidebar communication channels as appropriate
Showing
Please register or sign in to comment