Browse Source

Add delay on scrip reload

Leonardo Jeanteur 7 tháng trước cách đây
mục cha
commit
ed24414a3b
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  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);
+				});
 			}
 		}
 	}