   constructor: (params={}) ->
     {@blobStore, @applicationDelegate, @window, @document, configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params
 
-    debouncedSaveState = _.debounce((=> @saveState()), @saveStateDebounceInterval)
-    @document.addEventListener('mousedown', debouncedSaveState, true)
-    @document.addEventListener('keydown', debouncedSaveState, true)
-
-
     @loadTime = null
     {devMode, safeMode, resourcePath} = @getLoadSettings()
 

    @registerDefaultViewProviders()

    @installUncaughtErrorHandler()
    @installWindowEventHandler()

    @observeAutoHideMenuBar()

      ipc.send('check-portable-home-writable', responseChannel)

    checkPortableHomeWritable()

  attachSaveStateListeners: ->
    debouncedSaveState = _.debounce((=> @saveState()), @saveStateDebounceInterval)
    @document.addEventListener('mousedown', debouncedSaveState, true)
    @document.addEventListener('keydown', debouncedSaveState, true)
    @disposables.add new Disposable =>
      @document.removeEventListener('mousedown', debouncedSaveState, true)
      @document.removeEventListener('keydown', debouncedSaveState, true)

  setConfigSchema: ->
    @config.setSchema null, {type: 'object', properties: _.clone(require('./config-schema'))}
