debounce the beep

This commit is contained in:
MathuraMG 2016-08-08 13:49:45 -04:00
parent 7cb9475b44
commit 250cd0ae9d

View file

@ -35,7 +35,7 @@ class Editor extends React.Component {
gutters: ['CodeMirror-lint-markers'], gutters: ['CodeMirror-lint-markers'],
keyMap: 'sublime', keyMap: 'sublime',
lint: { lint: {
onUpdateLinting: (annotations) => { onUpdateLinting: debounce(2000, (annotations) => {
let isVisible = false; let isVisible = false;
document.getElementById('editor-lintmessages').innerHTML = ''; document.getElementById('editor-lintmessages').innerHTML = '';
annotations.forEach((x) => { annotations.forEach((x) => {
@ -47,7 +47,8 @@ class Editor extends React.Component {
if (isVisible) { if (isVisible) {
this.beep.play(); this.beep.play();
} }
} })
} }
}); });
this._cm.on('change', debounce(200, () => { this._cm.on('change', debounce(200, () => {