• Eduardo Sanz García's avatar
    Remove `AnnotationSync` utility · e63a0be7
    Eduardo Sanz García authored
    AnnotationSync utility didn't have a clear purpose, except for assigning a
    temporarily `$tag` to newly created annotations. For that, it used an
    internal cache of annotation objects from the Guest, that were mutated
    in-place. `AnnotationSync` used a very indirect method of communication
    to the `Guest`, using an event emitter, even though their mutual
    relationship was quite straightforward.
    
    In this PR, we have:
    
    * Simplified the messages that are sent between the host and the
      sidebar. We have assumed that a `$tag` value is always present if it
      comes from the `sidebar`, and a temporarily `$tag` is assigned in the
      `Guest` class for newly created annotations. Therefore, the type of
      the message sent between these two frames can be simplified to always
      be of the shape of `AnnotationData`, a safe version of `Annotation`.
    
    * Added a few missing types.
    
    * Changed the RPC method `deleteAnnotation` to send astring tag, similar
      to other RPC methods, like `focusAnnotations` or `scrollToAnnoation`.
      As a consequence of that we changed the `Guest#detach` method
      signature.
    e63a0be7
frames.js 4.03 KB