浏览代码

Comment debounced calls

Sebastien Lebreton 5 年之前
父节点
当前提交
a08282a873
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Playground/js/monacoCreator.js

+ 3 - 0
Playground/js/monacoCreator.js

@@ -326,6 +326,9 @@ class MonacoCreator {
         this.jsEditor = monaco.editor.create(document.getElementById('jsEditor'), editorOptions);
         this.jsEditor.setValue(oldCode);
 
+        // We cannot call 'analyzeCode' on every keystroke, that's time consuming
+        // So use a debounced version to prevent over processing.
+        // Be careful to keep the proper context for the effective call (this).
         const analyzeCodeDebounced = this.parent.utils.debounceAsync((async) => this.analyzeCode(), 500);
 
         this.jsEditor.onDidChangeModelContent(function () {