Commit 015e69ad authored by Denys Mishunov's avatar Denys Mishunov

Abstracted debounce into a constant

parent dc8ad68c
......@@ -5,3 +5,4 @@ export const EDITOR_LITE_INSTANCE_ERROR_NO_EL = __(
);
export const URI_PREFIX = 'gitlab';
export const CONTENT_UPDATE_DEBOUNCE = 250;
<script>
import { debounce } from 'lodash';
import Editor from '~/editor/editor_lite';
import { CONTENT_UPDATE_DEBOUNCE } from '~/editor/constants';
function initEditorLite({ el, ...args }) {
const editor = new Editor({
......@@ -67,7 +68,9 @@ export default {
...this.editorOptions,
});
this.editor.onDidChangeModelContent(debounce(this.onFileChange.bind(this), 250));
this.editor.onDidChangeModelContent(
debounce(this.onFileChange.bind(this), CONTENT_UPDATE_DEBOUNCE),
);
},
beforeDestroy() {
this.editor.dispose();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment