• Robert Knight's avatar
    Support feature flags in guest frames · 928548b0
    Robert Knight authored
    Rewrite the infrastructure that sends feature flags to annotator code, to
    support feature-flagging functionality in guest frames, instead of just the host
    frame.
    
     - Remove `FeaturesService` in the sidebar and move the logic for
       syncing feature flags from the sidebar to other frames into
       `FrameSyncService`.  This is a better place since `FrameSyncService`
       knows when frames connect and thus when to send flags to them. The
       logic for monitoring for flag changes is very simple and doesn't
       needs its own service.
    
     - Within `FrameSyncService`, send "featureFlagsUpdated" notifications to
       both host frames and guest frames.
    
     - Convert the functions and global variables in `annotator/features.js`
       into a `FeatureFlags` class, which encapsulates storage of flags,
       access to them and notifying consumers when flags change.
    
     - Instantiate `FeatureFlags` instances in the host frame and guest
       frame and update the flags stored in them when "featureFlagsUpdated" events
       are received from the sidebar.
    928548b0
sidebar.js 18.6 KB