Kaynağa Gözat

[js] workaround weird chrome (?) bug of $global not being reset on page reload
closes #8882

Aleksandr Kuzmenko 5 yıl önce
ebeveyn
işleme
47dd40736e
2 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 1 1
      src/generators/genjs.ml
  2. 1 1
      std/js/Lib.hx

+ 1 - 1
src/generators/genjs.ml

@@ -1776,7 +1776,7 @@ let generate com =
 	end;
 	if has_feature ctx "$global.$haxeUID" then begin
 		add_feature ctx "js.Lib.global";
-		print ctx "if(typeof $global.$haxeUID == \"undefined\") $global.$haxeUID = 0;\n";
+		print ctx "$global.$haxeUID |= 0;\n";
 	end;
 	List.iter (gen_block_element ~after:true ctx) (List.rev ctx.inits);
 	List.iter (generate_static ctx) (List.rev ctx.statics);

+ 1 - 1
std/js/Lib.hx

@@ -135,7 +135,7 @@ class Lib {
 		Generate next unique id
 	**/
 	@:allow(haxe.ds.ObjectMap.assignId)
-	static inline function getNextHaxeUID():{function nextId(counterName:String):Int;} {
+	static inline function getNextHaxeUID():Int {
 		return js.Syntax.code("{0}.$haxeUID++", untyped __define_feature__("$global.$haxeUID", global));
 	}
 }