• Sean Hammond's avatar
    Add hostPageSetting() method (not used yet) · 5a2181e3
    Sean Hammond authored
    Add a new `annotator.config.settingsFrom#hostPageSetting(settingName)`
    method that encapsulates a bunch of logic in one method:
    
    - It always returns null if the client is from a browser extension.
      Browser extensions don't read settings from the host page.
    - If the host page's `window.hypothesisConfig()` function returned a
      value for the requested setting, `hostPageSetting(settingName)` returns
      that value.
    - If `hypothesisConfig()` doesn't return the setting it looks for it in
      `js-hypothesis-config` scripts in the host page
    - If the setting isn't defined in either place it returns `undefined`.
    5a2181e3
settings.js 2.81 KB