Fix native declarations

This commit is contained in:
Alexey Andreev 2017-11-30 00:14:29 +03:00
parent ae68bc366b
commit 3c83c7e7b9
3 changed files with 9 additions and 4 deletions

View File

@ -21,6 +21,6 @@ public final class Navigator {
private Navigator() {
}
@JSBody(script = "return (window || self).navigator.onLine;")
@JSBody(script = "return navigator.onLine;")
public static native boolean isOnline();
}

View File

@ -22,9 +22,9 @@ public final class Performance implements JSObject {
private Performance() {
}
@JSBody(script = "return (window || self).performance.now();")
@JSBody(script = "return performance.now();")
public static native double now();
@JSBody(script = "return typeof((window || self).performance) !== 'undefined';")
@JSBody(script = "return typeof(performance) !== 'undefined';")
public static native boolean isSupported();
}

View File

@ -25,6 +25,8 @@ import org.teavm.jso.dom.html.HTMLElement;
import org.teavm.jso.dom.html.HTMLIFrameElement;
public abstract class Window implements JSObject, WindowEventTarget, StorageProvider, JSArrayReader<HTMLIFrameElement> {
private static Window cachedInstance;
private Window() {
}
@ -159,9 +161,12 @@ public abstract class Window implements JSObject, WindowEventTarget, StorageProv
postMessage(message, targetOrigin, JSArray.of(transfer));
}
@JSBody(script = "return window || self;")
@JSBody(script = "return window;")
public static native Window current();
@JSBody(script = "return self;")
public static native Window worker();
@JSBody(params = "uri", script = "return encodeURI(uri);")
public static native String encodeURI(String uri);