mirror of
https://github.com/atom/atom.git
synced 2026-02-07 13:14:55 -05:00
Assign debounce interval to property
This commit is contained in:
@@ -179,12 +179,12 @@ describe "AtomEnvironment", ->
|
||||
|
||||
keypress = new KeyboardEvent('keypress')
|
||||
atom.document.dispatchEvent(keypress)
|
||||
advanceClock 1100
|
||||
advanceClock atom.saveStateDebounceInterval
|
||||
expect(atom.saveStateSync).toHaveBeenCalled()
|
||||
|
||||
mousedown = new MouseEvent('mousedown')
|
||||
atom.document.dispatchEvent(mousedown)
|
||||
advanceClock 1100
|
||||
advanceClock atom.saveStateDebounceInterval
|
||||
expect(atom.saveStateSync).toHaveBeenCalled()
|
||||
|
||||
describe "openInitialEmptyEditorIfNecessary", ->
|
||||
|
||||
@@ -111,6 +111,8 @@ class AtomEnvironment extends Model
|
||||
# Public: A {Workspace} instance
|
||||
workspace: null
|
||||
|
||||
saveStateDebounceInterval: 1000
|
||||
|
||||
###
|
||||
Section: Construction and Destruction
|
||||
###
|
||||
@@ -119,7 +121,7 @@ class AtomEnvironment extends Model
|
||||
constructor: (params={}) ->
|
||||
{@blobStore, @applicationDelegate, @window, @document, configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params
|
||||
|
||||
debouncedSaveStateSync = _.debounce((=> @saveStateSync()), 1000)
|
||||
debouncedSaveStateSync = _.debounce((=> @saveStateSync()), @saveStateDebounceInterval)
|
||||
@document.addEventListener('mousedown', debouncedSaveStateSync, true)
|
||||
@document.addEventListener('keypress', debouncedSaveStateSync, true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user