old_contents: import assign from 'object-assign';
  import EventEmitter from 'eventemitter3';
  import dispatcher from '../dispatcher';
  
  const SETTINGS_KEY = 'uwaveSettings';
  
  const settings = {
    muted: false,
    videoSize: 'large',
    volume: 0
  };
  
  // cookie blocking safe localStorage settings persistence
  function load() {
    try {
      assign(settings, JSON.parse(localStorage.getItem(SETTINGS_KEY)));
    } catch (e) {
      // Ok!
    }
  }
  function save() {
    try {
      localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings));
    } catch (e) {
      // Ok!
    }
  }
  
  const SettingsStore = assign(new EventEmitter, {
    getAll() {
      return assign({}, settings);
    },
    getSetting(name) {
      return settings[name];
    },
  
    dispatchToken: dispatcher.register(({ type, payload }) => {
      switch (type) {
      case 'loadSettings':
      case 'setSettings':
        assign(settings, payload);
        SettingsStore.emit('change');
        break;
      default:
        // Not for us
      }
    })
  });
  
  SettingsStore.on('change', save);
  load();
  
  export default SettingsStore;
  
new_contents: import Store from './Store';
  
  const SETTINGS_KEY = 'uwaveSettings';
  
  const initialState = {
    muted: false,
    videoSize: 'large',
    volume: 0
  };
  
  function reduce(state = initialState, action = {}) {
    const { type, payload } = action;
    switch (type) {
    case 'loadSettings':
    case 'setSettings':
      return { ...state, ...payload };
    default:
      return state;
    }
  }
  
  class SettingsStore extends Store {
    constructor() {
      super();
      this.on('change', ::this.save);
      this.load();
    }
  
    reduce(state, action) {
      return reduce(state, action);
    }
  
    getAll() {
      return this.state;
    }
    getSetting(name) {
      return this.state[name];
    }
  
    // localStorage settings persistence. try-catches are to deal with cookie
    // blocking.
    load() {
      try {
        this.state = this.reduce(this.state, {
          type: 'loadSettings',
          payload: JSON.parse(localStorage.getItem(SETTINGS_KEY))
        });
      } catch (e) {
        // Ok!
      }
    }
  
    save() {
      try {
        localStorage.setItem(SETTINGS_KEY, JSON.stringify(this.state));
      } catch (e) {
        // Ok!
      }
    }
  }
  
  export default new SettingsStore;
  
subject: rewrite SettingsStore as a reducer function