Change __js__ for js.Syntax.code on Haxe 4 (resolve #1397)
This commit is contained in:
@@ -279,13 +279,13 @@ class HTML5Application
|
||||
Browser.window.addEventListener("devicemotion", handleSensorEvent, false);
|
||||
|
||||
#if stats
|
||||
stats = untyped __js__("new Stats ()");
|
||||
stats = untyped #if haxe4 js.Syntax.code #else __js__ #end("new Stats ()");
|
||||
stats.domElement.style.position = "absolute";
|
||||
stats.domElement.style.top = "0px";
|
||||
Browser.document.body.appendChild(stats.domElement);
|
||||
#end
|
||||
|
||||
untyped __js__("
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("
|
||||
if (!CanvasRenderingContext2D.prototype.isPointInStroke) {
|
||||
CanvasRenderingContext2D.prototype.isPointInStroke = function (path, x, y) {
|
||||
return false;
|
||||
|
||||
@@ -453,7 +453,7 @@ class HTML5HTTPRequest
|
||||
|
||||
if (supportsImageProgress == null)
|
||||
{
|
||||
supportsImageProgress = untyped __js__("'onprogress' in image");
|
||||
supportsImageProgress = untyped #if haxe4 js.Syntax.code #else __js__ #end("'onprogress' in image");
|
||||
}
|
||||
|
||||
if (supportsImageProgress || __isInMemoryURI(uri))
|
||||
|
||||
@@ -25,9 +25,9 @@ class Deflate
|
||||
#end
|
||||
#elseif js
|
||||
#if commonjs
|
||||
var data = untyped __js__("require (\"pako\").deflateRaw")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("require (\"pako\").deflateRaw")(bytes.getData());
|
||||
#else
|
||||
var data = untyped __js__("pako.deflateRaw")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("pako.deflateRaw")(bytes.getData());
|
||||
#end
|
||||
return Bytes.ofData(data);
|
||||
#elseif flash
|
||||
@@ -55,9 +55,9 @@ class Deflate
|
||||
#end
|
||||
#elseif js
|
||||
#if commonjs
|
||||
var data = untyped __js__("require (\"pako\").inflateRaw")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("require (\"pako\").inflateRaw")(bytes.getData());
|
||||
#else
|
||||
var data = untyped __js__("pako.inflateRaw")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("pako.inflateRaw")(bytes.getData());
|
||||
#end
|
||||
return Bytes.ofData(data);
|
||||
#elseif flash
|
||||
|
||||
@@ -22,9 +22,9 @@ class GZip
|
||||
#end
|
||||
#elseif js
|
||||
#if commonjs
|
||||
var data = untyped __js__("require (\"pako\").gzip")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("require (\"pako\").gzip")(bytes.getData());
|
||||
#else
|
||||
var data = untyped __js__("pako.gzip")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("pako.gzip")(bytes.getData());
|
||||
#end
|
||||
return Bytes.ofData(data);
|
||||
#else
|
||||
@@ -44,9 +44,9 @@ class GZip
|
||||
#end
|
||||
#elseif js
|
||||
#if commonjs
|
||||
var data = untyped __js__("require (\"pako\").ungzip")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("require (\"pako\").ungzip")(bytes.getData());
|
||||
#else
|
||||
var data = untyped __js__("pako.ungzip")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("pako.ungzip")(bytes.getData());
|
||||
#end
|
||||
return Bytes.ofData(data);
|
||||
#else
|
||||
|
||||
@@ -25,9 +25,9 @@ class Zlib
|
||||
#end
|
||||
#elseif js
|
||||
#if commonjs
|
||||
var data = untyped __js__("require (\"pako\").deflate")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("require (\"pako\").deflate")(bytes.getData());
|
||||
#else
|
||||
var data = untyped __js__("pako.deflate")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("pako.deflate")(bytes.getData());
|
||||
#end
|
||||
return Bytes.ofData(data);
|
||||
#elseif flash
|
||||
@@ -55,9 +55,9 @@ class Zlib
|
||||
#end
|
||||
#elseif js
|
||||
#if commonjs
|
||||
var data = untyped __js__("require (\"pako\").inflate")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("require (\"pako\").inflate")(bytes.getData());
|
||||
#else
|
||||
var data = untyped __js__("pako.inflate")(bytes.getData());
|
||||
var data = untyped #if haxe4 js.Syntax.code #else __js__ #end("pako.inflate")(bytes.getData());
|
||||
#end
|
||||
return Bytes.ofData(data);
|
||||
#elseif flash
|
||||
|
||||
@@ -190,7 +190,7 @@ class ImageCanvasUtil
|
||||
if (!image.transparent)
|
||||
{
|
||||
if (!image.transparent) buffer.__srcCanvas.setAttribute("moz-opaque", "true");
|
||||
buffer.__srcContext = untyped __js__('buffer.__srcCanvas.getContext ("2d", { alpha: false })');
|
||||
buffer.__srcContext = untyped #if haxe4 js.Syntax.code #else __js__ #end('buffer.__srcCanvas.getContext ("2d", { alpha: false })');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1439,7 +1439,7 @@ class Image
|
||||
{
|
||||
#if (js && html5)
|
||||
#if openfljs
|
||||
var image:JSImage = untyped __js__('new window.Image ()');
|
||||
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end('new window.Image ()');
|
||||
#else
|
||||
var image = new JSImage();
|
||||
#end
|
||||
@@ -1575,7 +1575,7 @@ class Image
|
||||
});
|
||||
#elseif (js && html5)
|
||||
#if openfljs
|
||||
var image:JSImage = untyped __js__('new window.Image ()');
|
||||
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end('new window.Image ()');
|
||||
#else
|
||||
var image = new JSImage();
|
||||
#end
|
||||
|
||||
@@ -30,8 +30,8 @@ class AudioContext
|
||||
{
|
||||
try
|
||||
{
|
||||
untyped __js__("window.AudioContext = window.AudioContext || window.webkitAudioContext;");
|
||||
web = cast untyped __js__("new window.AudioContext ()");
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("window.AudioContext = window.AudioContext || window.webkitAudioContext;");
|
||||
web = cast untyped #if haxe4 js.Syntax.code #else __js__ #end("new window.AudioContext ()");
|
||||
this.type = WEB;
|
||||
}
|
||||
catch (e:Dynamic) {}
|
||||
|
||||
@@ -59,29 +59,29 @@ class Font
|
||||
|
||||
if (!__init)
|
||||
{
|
||||
#if js if (ascender == untyped __js__("undefined")) #end ascender = 0;
|
||||
#if js if (ascender == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined")) #end ascender = 0;
|
||||
#if js
|
||||
if (descender == untyped __js__("undefined"))
|
||||
if (descender == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined"))
|
||||
#end
|
||||
descender = 0;
|
||||
#if js
|
||||
if (height == untyped __js__("undefined"))
|
||||
if (height == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined"))
|
||||
#end
|
||||
height = 0;
|
||||
#if js
|
||||
if (numGlyphs == untyped __js__("undefined"))
|
||||
if (numGlyphs == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined"))
|
||||
#end
|
||||
numGlyphs = 0;
|
||||
#if js
|
||||
if (underlinePosition == untyped __js__("undefined"))
|
||||
if (underlinePosition == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined"))
|
||||
#end
|
||||
underlinePosition = 0;
|
||||
#if js
|
||||
if (underlineThickness == untyped __js__("undefined"))
|
||||
if (underlineThickness == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined"))
|
||||
#end
|
||||
underlineThickness = 0;
|
||||
#if js
|
||||
if (unitsPerEM == untyped __js__("undefined"))
|
||||
if (unitsPerEM == untyped #if haxe4 js.Syntax.code #else __js__ #end("undefined"))
|
||||
#end
|
||||
unitsPerEM = 0;
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ class FileDialog
|
||||
var buffer = (data : Bytes).getData();
|
||||
|
||||
#if commonjs
|
||||
untyped __js__("require ('file-saver')")(new Blob([buffer], {type: type}), path, true);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("require ('file-saver')")(new Blob([buffer], {type: type}), path, true);
|
||||
#else
|
||||
untyped window.saveAs(new Blob([buffer], {type: type}), path, true);
|
||||
#end
|
||||
|
||||
@@ -16,7 +16,7 @@ class Log
|
||||
if (level >= LogLevel.DEBUG)
|
||||
{
|
||||
#if js
|
||||
untyped __js__("console").debug("[" + info.className + "] " + message);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").debug("[" + info.className + "] " + message);
|
||||
#else
|
||||
println("[" + info.className + "] " + Std.string(message));
|
||||
#end
|
||||
@@ -36,7 +36,7 @@ class Log
|
||||
else
|
||||
{
|
||||
#if js
|
||||
untyped __js__("console").error(message);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").error(message);
|
||||
#else
|
||||
println(message);
|
||||
#end
|
||||
@@ -49,7 +49,7 @@ class Log
|
||||
if (level >= LogLevel.INFO)
|
||||
{
|
||||
#if js
|
||||
untyped __js__("console").info("[" + info.className + "] " + message);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").info("[" + info.className + "] " + message);
|
||||
#else
|
||||
println("[" + info.className + "] " + Std.string(message));
|
||||
#end
|
||||
@@ -63,7 +63,7 @@ class Log
|
||||
#elseif flash
|
||||
untyped __global__["trace"](Std.string(message));
|
||||
#elseif js
|
||||
untyped __js__("console").log(message);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").log(message);
|
||||
#else
|
||||
trace(message);
|
||||
#end
|
||||
@@ -76,7 +76,7 @@ class Log
|
||||
#elseif flash
|
||||
untyped __global__["trace"](Std.string(message));
|
||||
#elseif js
|
||||
untyped __js__("console").log(message);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").log(message);
|
||||
#else
|
||||
trace(Std.string(message));
|
||||
#end
|
||||
@@ -95,7 +95,7 @@ class Log
|
||||
if (level >= LogLevel.WARN)
|
||||
{
|
||||
#if js
|
||||
untyped __js__("console").warn("[" + info.className + "] WARNING: " + message);
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").warn("[" + info.className + "] WARNING: " + message);
|
||||
#else
|
||||
println("[" + info.className + "] WARNING: " + Std.string(message));
|
||||
#end
|
||||
@@ -127,13 +127,13 @@ class Log
|
||||
#end
|
||||
|
||||
#if js
|
||||
if (untyped __js__("typeof console") == "undefined")
|
||||
if (untyped #if haxe4 js.Syntax.code #else __js__ #end("typeof console") == "undefined")
|
||||
{
|
||||
untyped __js__("console = {}");
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console = {}");
|
||||
}
|
||||
if (untyped __js__("console").log == null)
|
||||
if (untyped #if haxe4 js.Syntax.code #else __js__ #end("console").log == null)
|
||||
{
|
||||
untyped __js__("console").log = function() {};
|
||||
untyped #if haxe4 js.Syntax.code #else __js__ #end("console").log = function() {};
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user