• Eduardo Sanz García's avatar
    Remove `PortProvider#hostPortFrom` method · f364519b
    Eduardo Sanz García authored
    There are two methods to get the host port from `PortProvider`:
    
    - `#hostPortFrom` which returns the host port exclusively from the
      `sidebar-host` channel.
    
    - `#on` allows to register a listener that is fired upon requests
      of host frames for channels other than the `sidebar-host`.
    
    This is an attempt to simplify the API of `PortProvider` and merge both
    methods into one.
    
    Advantages:
    
    - simplifies the `Sidebar` constructor signature (no need to pass the
      host port)
    
    - avoids the pitfall of creating host-sidebar RPC channel before
      registering the RPC methods
    
    - prepares for future guest-host channel see https://github.com/hypothesis/client/blob/ad93317debdac0d2c3abec83eb9d690934632ef3/src/annotator/index.js#L64-L66 (where the `#on` method is use to create the guest-host channel).
    f364519b
port-provider.js 7.02 KB