Bläddra i källkod

Update variable names for XHR progress event with compat. (#440)

Pavel Alexandrov 7 år sedan
förälder
incheckning
337f9f5d97
1 ändrade filer med 7 tillägg och 1 borttagningar
  1. 7 1
      hxd/net/BinaryLoader.hx

+ 7 - 1
hxd/net/BinaryLoader.hx

@@ -46,7 +46,13 @@ class BinaryLoader {
 			onLoaded(haxe.io.Bytes.ofData(xhr.response));
 		}
 		
-		xhr.onprogress = function(e) onProgress(Std.int(e.position), Std.int(e.totalSize));
+		xhr.onprogress = function(e) {
+			#if (haxe_ver >= 4)
+			onProgress(Std.int(js.Syntax.code("{0}.loaded || {0}.position", e)), Std.int(js.Syntax.code("{0}.total || {0}.totalSize", e)));
+			#else
+			onProgress(Std.int(untyped __js__("{0}.loaded || {0}.position", e)), Std.int(untyped __js__("{0}.total || {0}.totalSize", e)));
+			#end
+		}
 		xhr.send();
 		#end
 	}