• Sean Hammond's avatar
    Use hostPageSetting() instead of Object.assign() · b8cff0a2
    Sean Hammond authored
    Use the new `settings.hostPageSetting()` method in `index.js`.
    
    This means that `index.js` no longer uses `shared/settings.js`
    (`jsonConfigsFrom()`) or `configFuncSettingsFrom()`. These are both
    encapsulated in `hostPageSetting()`.
    
    Previously `index.js` blindly assigned a lot of property names and
    values fo the `config` object using a couple of `Object.assign()` calls:
    
        Object.assign(config, sharedSettings.jsonConfigsFrom(window_.document));
        Object.assign(config, configFuncSettingsFrom(window_));
    
    These `Object.assign()`s are now gone, and instead it explicitly assigns
    each property to the `config` object by name:
    
        var config = {
          app: settings.app,
          query: settings.query,
          ...
          openLoginForm: settings.hostPageSetting('openLoginForm'),
          openSidebar: settings.hostPageSetting('openSidebar'),
          ...
        };
    
    (Some of these settings were already being assigned in this way, but the
    ones that uses `hostPageSetting()` are new.)
    
    This also means that `index.js` no longer uses `isBrowserExtension()`.
    Previously `index.js` contained logic to return early, declining to read
    various config settings from the host page using its `Object.assign()`s,
    if the client was running in a browser extension. This logic is also now
    encapsulated in the new `settings.hostPageSetting()` method and so is
    removed from `index.js`.
    b8cff0a2
index.js 1.03 KB