浏览代码

Add delay on scrip reload

Leonardo Jeanteur 7 月之前
父节点
当前提交
ed24414a3b
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      hide/comp/ScriptEditor.hx

+ 6 - 1
hide/comp/ScriptEditor.hx

@@ -43,7 +43,12 @@ class ScriptCache {
 				var path = ide.getPath(f);
 				var content = try sys.io.File.getContent(path) catch( e : Dynamic ) { @:privateAccess ScriptChecker.error(""+e); continue; };
 				types.addXmlApi(Xml.parse(content).firstElement());
-				ide.fileWatcher.register(f, function() { onApiFileChange(); loadFiles(files); });
+				ide.fileWatcher.register(f, function() {
+					haxe.Timer.delay(() -> {
+						onApiFileChange();
+						loadFiles(files);
+					}, 50);
+				});
 			}
 		}
 	}