mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Further refactoring of JSO
This commit is contained in:
parent
ac3159aadf
commit
a5ffd11151
1
pom.xml
1
pom.xml
|
@ -85,6 +85,7 @@
|
|||
<module>teavm-chrome-rdp</module>
|
||||
<module>teavm-tests</module>
|
||||
<module>teavm-extras-slf4j</module>
|
||||
<module>teavm-jso-impl</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -54,11 +54,6 @@
|
|||
<artifactId>teavm-jso</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-dom</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.dom.browser.TimerHandler;
|
||||
import org.teavm.javascript.spi.Async;
|
||||
import org.teavm.javascript.spi.Rename;
|
||||
import org.teavm.javascript.spi.Superclass;
|
||||
import org.teavm.javascript.spi.Sync;
|
||||
import org.teavm.jso.browser.TimerHandler;
|
||||
import org.teavm.platform.Platform;
|
||||
import org.teavm.platform.PlatformQueue;
|
||||
import org.teavm.platform.PlatformRunnable;
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.dom.browser.Window;
|
||||
import org.teavm.javascript.spi.Async;
|
||||
import org.teavm.jso.JS;
|
||||
import org.teavm.platform.Platform;
|
||||
import org.teavm.platform.PlatformRunnable;
|
||||
import org.teavm.platform.async.AsyncCallback;
|
||||
|
@ -27,7 +25,6 @@ import org.teavm.platform.async.AsyncCallback;
|
|||
* @author Alexey Andreev
|
||||
*/
|
||||
public class TThread extends TObject implements TRunnable {
|
||||
private static Window window = (Window) JS.getGlobal();
|
||||
private static TThread mainThread = new TThread(TString.wrap("main"));
|
||||
private static TThread currentThread = mainThread;
|
||||
private static long nextId = 1;
|
||||
|
|
|
@ -18,9 +18,8 @@ package org.teavm.classlib.java.util;
|
|||
import org.teavm.classlib.java.lang.TIllegalStateException;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.dom.browser.TimerHandler;
|
||||
import org.teavm.dom.browser.Window;
|
||||
import org.teavm.jso.JS;
|
||||
import org.teavm.jso.browser.TimerHandler;
|
||||
import org.teavm.jso.browser.Window;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,19 +50,13 @@ public class TTimer extends TObject {
|
|||
throw new TIllegalStateException();
|
||||
}
|
||||
task.timer = this;
|
||||
task.nativeTimerId = ((Window) JS.getGlobal()).setTimeout(new TimerHandler() {
|
||||
@Override
|
||||
public void onTimer() {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cancelled || task.timer == null) {
|
||||
return;
|
||||
}
|
||||
TTimerTask.performOnce(task);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
task.nativeTimerId = Window.setTimeout(() -> {
|
||||
new Thread(() -> {
|
||||
if (cancelled || task.timer == null) {
|
||||
return;
|
||||
}
|
||||
TTimerTask.performOnce(task);
|
||||
}).start();
|
||||
}, (int) delay);
|
||||
}
|
||||
|
||||
|
@ -72,24 +65,20 @@ public class TTimer extends TObject {
|
|||
throw new TIllegalStateException();
|
||||
}
|
||||
task.timer = this;
|
||||
task.nativeTimerId = ((Window) JS.getGlobal()).setTimeout(new TimerHandler() {
|
||||
@Override
|
||||
public void onTimer() {
|
||||
final TimerHandler self = this;
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cancelled || task.timer == null) {
|
||||
return;
|
||||
}
|
||||
task.nativeTimerId = ((Window) JS.getGlobal()).setTimeout(self, (int) period);
|
||||
TTimerTask.performOnce(task);
|
||||
if (!cancelled) {
|
||||
task.timer = TTimer.this;
|
||||
}
|
||||
TimerHandler handler = new TimerHandler() {
|
||||
@Override public void onTimer() {
|
||||
new Thread(() -> {
|
||||
if (cancelled || task.timer == null) {
|
||||
return;
|
||||
}
|
||||
}.start();
|
||||
task.nativeTimerId = Window.setTimeout(this, (int) period);
|
||||
TTimerTask.performOnce(task);
|
||||
if (!cancelled) {
|
||||
task.timer = TTimer.this;
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}, (int) delay);
|
||||
};
|
||||
task.nativeTimerId = Window.setTimeout(handler, (int) delay);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.ajax;
|
||||
|
||||
import org.teavm.dom.core.Document;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface XMLHttpRequest extends JSObject {
|
||||
int UNSET = 0;
|
||||
|
||||
int OPENED = 1;
|
||||
|
||||
int HEADERS_RECEIVED = 2;
|
||||
|
||||
int LOADING = 3;
|
||||
|
||||
int DONE = 4;
|
||||
|
||||
void open(String method, String url);
|
||||
|
||||
void open(String method, String url, boolean async);
|
||||
|
||||
void open(String method, String url, boolean async, String user);
|
||||
|
||||
void open(String method, String url, boolean async, String user, String password);
|
||||
|
||||
void send();
|
||||
|
||||
void send(String data);
|
||||
|
||||
void setRequestHeader(String name, String value);
|
||||
|
||||
String getAllResponseHeaders();
|
||||
|
||||
String getResponseHeader(String name);
|
||||
|
||||
@JSProperty("onreadystatechange")
|
||||
void setOnReadyStateChange(ReadyStateChangeHandler handler);
|
||||
|
||||
void overrideMimeType(String mimeType);
|
||||
|
||||
@JSProperty
|
||||
int getReadyState();
|
||||
|
||||
@JSProperty
|
||||
String getResponseText();
|
||||
|
||||
@JSProperty
|
||||
Document getResponseXML();
|
||||
|
||||
@JSProperty
|
||||
JSObject getResponse();
|
||||
|
||||
@JSProperty
|
||||
int getStatus();
|
||||
|
||||
@JSProperty
|
||||
String getStatusText();
|
||||
|
||||
@JSProperty
|
||||
void setResponseType(String type);
|
||||
|
||||
@JSProperty
|
||||
String getResponseType();
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.browser;
|
||||
|
||||
import org.teavm.dom.ajax.XMLHttpRequest;
|
||||
import org.teavm.dom.events.EventTarget;
|
||||
import org.teavm.dom.html.HTMLDocument;
|
||||
import org.teavm.dom.json.JSON;
|
||||
import org.teavm.dom.typedarrays.TypedArrayFactory;
|
||||
import org.teavm.jso.JSConstructor;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface Window extends JSObject, EventTarget, StorageProvider, TypedArrayFactory {
|
||||
@JSProperty
|
||||
HTMLDocument getDocument();
|
||||
|
||||
@JSProperty
|
||||
Screen getScreen();
|
||||
|
||||
void alert(JSObject message);
|
||||
|
||||
void alert(String message);
|
||||
|
||||
int setTimeout(TimerHandler handler, int delay);
|
||||
|
||||
int setTimeout(TimerHandler handler, double delay);
|
||||
|
||||
void clearTimeout(int timeoutId);
|
||||
|
||||
int setInterval(TimerHandler handler, int delay);
|
||||
|
||||
int setInterval(TimerHandler handler, double delay);
|
||||
|
||||
void clearInterval(int timeoutId);
|
||||
|
||||
@JSProperty("JSON")
|
||||
JSON getJSON();
|
||||
|
||||
@JSConstructor("XMLHttpRequest")
|
||||
XMLHttpRequest createXMLHttpRequest();
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.typedarrays;
|
||||
|
||||
import org.teavm.jso.JSConstructor;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface TypedArrayFactory extends JSObject {
|
||||
@JSConstructor("ArrayBuffer")
|
||||
ArrayBuffer createArrayBuffer(int length);
|
||||
|
||||
@JSConstructor("Int8Array")
|
||||
Int8Array createInt8Array(int length);
|
||||
|
||||
@JSConstructor("Int8Array")
|
||||
Int8Array createInt8Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Int8Array")
|
||||
Int8Array createInt8Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Uint8Array")
|
||||
Uint8Array createUint8Array(int length);
|
||||
|
||||
@JSConstructor("Uint8Array")
|
||||
Uint8Array createUint8Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Uint8Array")
|
||||
Uint8Array createUint8Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Uint8ClampedArray createUint8ClampedArray(int length);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Uint8ClampedArray createUintClamped8Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Int16Array")
|
||||
Int16Array createInt16Array(int length);
|
||||
|
||||
@JSConstructor("Int16Array")
|
||||
Int16Array createInt16Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Int16Array")
|
||||
Int16Array createInt16Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Uint16Array")
|
||||
Uint16Array createUint16Array(int length);
|
||||
|
||||
@JSConstructor("Uint16Array")
|
||||
Uint16Array createUint16Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Uint16Array")
|
||||
Uint16Array createUint16Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Int32Array")
|
||||
Int32Array createInt32Array(int length);
|
||||
|
||||
@JSConstructor("Int32Array")
|
||||
Int32Array createInt32Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Int32Array")
|
||||
Int32Array createInt32Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Float32Array")
|
||||
Float32Array createFloat32Array(int length);
|
||||
|
||||
@JSConstructor("Float32Array")
|
||||
Float32Array createFloat32Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Float32Array")
|
||||
Float32Array createFloat32Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Float64Array")
|
||||
Float64Array createFloat64Array(int length);
|
||||
|
||||
@JSConstructor("Float64Array")
|
||||
Float64Array createFloat64Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Float64Array")
|
||||
Float64Array createFloat64Array(ArrayBuffer buffer, int offset, int length);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.typedarrays;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface Uint8ClampedArray extends ArrayBufferView {
|
||||
@JSIndexer
|
||||
short get(int index);
|
||||
|
||||
@JSIndexer
|
||||
void set(int index, int value);
|
||||
}
|
4
teavm-jso-impl/.gitignore
vendored
Normal file
4
teavm-jso-impl/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/target/
|
||||
/.settings/
|
||||
/.classpath
|
||||
/.project
|
67
teavm-jso-impl/pom.xml
Normal file
67
teavm-jso-impl/pom.xml
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!--
|
||||
Copyright 2015 Alexey Andreev.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm</artifactId>
|
||||
<version>0.4.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>teavm-jso-impl</artifactId>
|
||||
|
||||
<name>TeaVM JavaScript objects - implementation</name>
|
||||
<description>An implementation of JSO</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-jso</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>../checkstyle.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -13,21 +13,28 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.plugin;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Iterator;
|
||||
import org.teavm.dependency.PluggableDependency;
|
||||
import org.teavm.javascript.spi.GeneratedBy;
|
||||
import org.teavm.javascript.spi.InjectedBy;
|
||||
import org.teavm.jso.plugin.JSNativeGenerator;
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSType;
|
||||
import org.teavm.jso.core.JSArray;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
import org.teavm.jso.core.JSBoolean;
|
||||
import org.teavm.jso.core.JSNumber;
|
||||
import org.teavm.jso.core.JSString;
|
||||
|
||||
/**
|
||||
* <p>Container of static methods to manipulate over {@link JSObject}s.</p>
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public final class JS {
|
||||
final class JS {
|
||||
private JS() {
|
||||
}
|
||||
|
|
@ -26,7 +26,6 @@ import org.teavm.javascript.spi.Generator;
|
|||
import org.teavm.javascript.spi.GeneratorContext;
|
||||
import org.teavm.javascript.spi.Injector;
|
||||
import org.teavm.javascript.spi.InjectorContext;
|
||||
import org.teavm.jso.JS;
|
||||
import org.teavm.model.CallLocation;
|
||||
import org.teavm.model.ClassReader;
|
||||
import org.teavm.model.MethodReader;
|
|
@ -25,19 +25,14 @@ import java.util.Set;
|
|||
import org.teavm.diagnostics.Diagnostics;
|
||||
import org.teavm.javascript.spi.GeneratedBy;
|
||||
import org.teavm.javascript.spi.Sync;
|
||||
import org.teavm.jso.JS;
|
||||
import org.teavm.jso.JSArray;
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSBooleanArray;
|
||||
import org.teavm.jso.JSConstructor;
|
||||
import org.teavm.jso.JSDoubleArray;
|
||||
import org.teavm.jso.JSFunctor;
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSIntArray;
|
||||
import org.teavm.jso.JSMethod;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.JSStringArray;
|
||||
import org.teavm.jso.core.JSArray;
|
||||
import org.teavm.model.AccessLevel;
|
||||
import org.teavm.model.AnnotationHolder;
|
||||
import org.teavm.model.AnnotationReader;
|
|
@ -28,12 +28,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
|
|||
<description>A library that adds convenient interface for interaction between TeaVM and JavaScript code</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -20,4 +20,8 @@ package org.teavm.jso;
|
|||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface JSObject {
|
||||
@SuppressWarnings("unchecked")
|
||||
default <T extends JSObject> T cast() {
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.ajax;
|
||||
package org.teavm.jso.ajax;
|
||||
|
||||
import org.teavm.jso.JSFunctor;
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso.ajax;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.xml.Document;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public abstract class XMLHttpRequest implements JSObject {
|
||||
public static final int UNSET = 0;
|
||||
|
||||
public static final int OPENED = 1;
|
||||
|
||||
public static final int HEADERS_RECEIVED = 2;
|
||||
|
||||
public static final int LOADING = 3;
|
||||
|
||||
public static final int DONE = 4;
|
||||
|
||||
public abstract void open(String method, String url);
|
||||
|
||||
public abstract void open(String method, String url, boolean async);
|
||||
|
||||
public abstract void open(String method, String url, boolean async, String user);
|
||||
|
||||
public abstract void open(String method, String url, boolean async, String user, String password);
|
||||
|
||||
public abstract void send();
|
||||
|
||||
public abstract void send(String data);
|
||||
|
||||
public abstract void setRequestHeader(String name, String value);
|
||||
|
||||
public abstract String getAllResponseHeaders();
|
||||
|
||||
public abstract String getResponseHeader(String name);
|
||||
|
||||
@JSProperty("onreadystatechange")
|
||||
public abstract void setOnReadyStateChange(ReadyStateChangeHandler handler);
|
||||
|
||||
public abstract void overrideMimeType(String mimeType);
|
||||
|
||||
@JSProperty
|
||||
public abstract int getReadyState();
|
||||
|
||||
@JSProperty
|
||||
public abstract String getResponseText();
|
||||
|
||||
@JSProperty
|
||||
public abstract Document getResponseXML();
|
||||
|
||||
@JSProperty
|
||||
public abstract JSObject getResponse();
|
||||
|
||||
@JSProperty
|
||||
public abstract int getStatus();
|
||||
|
||||
@JSProperty
|
||||
public abstract String getStatusText();
|
||||
|
||||
@JSProperty
|
||||
public abstract void setResponseType(String type);
|
||||
|
||||
@JSProperty
|
||||
public abstract String getResponseType();
|
||||
|
||||
@JSBody(params = {}, script = "return new XMLHttpRequest();")
|
||||
public static native XMLHttpRequest create();
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.browser;
|
||||
package org.teavm.jso.browser;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.browser;
|
||||
package org.teavm.jso.browser;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
@ -22,18 +22,17 @@ import org.teavm.jso.JSProperty;
|
|||
*
|
||||
* @author Junji Takakura
|
||||
*/
|
||||
public interface Storage extends JSObject {
|
||||
|
||||
public abstract class Storage implements JSObject {
|
||||
@JSProperty
|
||||
int getLength();
|
||||
public abstract int getLength();
|
||||
|
||||
String key(int index);
|
||||
public abstract String key(int index);
|
||||
|
||||
String getItem(String key);
|
||||
public abstract String getItem(String key);
|
||||
|
||||
void setItem(String key, String value);
|
||||
public abstract void setItem(String key, String value);
|
||||
|
||||
void removeItem(String key);
|
||||
public abstract void removeItem(String key);
|
||||
|
||||
void clear();
|
||||
public abstract void clear();
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.browser;
|
||||
package org.teavm.jso.browser;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.browser;
|
||||
package org.teavm.jso.browser;
|
||||
|
||||
import org.teavm.jso.JSFunctor;
|
||||
import org.teavm.jso.JSObject;
|
64
teavm-jso/src/main/java/org/teavm/jso/browser/Window.java
Normal file
64
teavm-jso/src/main/java/org/teavm/jso/browser/Window.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso.browser;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.events.EventTarget;
|
||||
import org.teavm.jso.dom.html.HTMLDocument;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public abstract class Window implements JSObject, EventTarget, StorageProvider {
|
||||
private Window() {
|
||||
}
|
||||
|
||||
@JSProperty
|
||||
public abstract HTMLDocument getDocument();
|
||||
|
||||
@JSProperty
|
||||
public abstract Screen getScreen();
|
||||
|
||||
@JSBody(params = "message", script = "alert(message);")
|
||||
public static native void alert(JSObject message);
|
||||
|
||||
@JSBody(params = "message", script = "alert(message);")
|
||||
public static native void alert(String message);
|
||||
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setTimeout(handler, delay);")
|
||||
public static native int setTimeout(TimerHandler handler, int delay);
|
||||
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setTimeout(handler, delay);")
|
||||
public static native int setTimeout(TimerHandler handler, double delay);
|
||||
|
||||
@JSBody(params = { "timeoutId" }, script = "clearTimeout(timeoutId);")
|
||||
public abstract void clearTimeout(int timeoutId);
|
||||
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setInverval(handler, delay);")
|
||||
public abstract int setInterval(TimerHandler handler, int delay);
|
||||
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setInverval(handler, delay);")
|
||||
public abstract int setInterval(TimerHandler handler, double delay);
|
||||
|
||||
@JSBody(params = { "timeoutId" }, script = "clearInverval(timeoutId);")
|
||||
public abstract void clearInterval(int timeoutId);
|
||||
|
||||
@JSBody(params = {}, script = "return window;")
|
||||
public static native Window current();
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.canvas;
|
||||
package org.teavm.jso.canvas;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.canvas;
|
||||
package org.teavm.jso.canvas;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.canvas;
|
||||
package org.teavm.jso.canvas;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
|
@ -13,14 +13,14 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.canvas;
|
||||
package org.teavm.jso.canvas;
|
||||
|
||||
import org.teavm.dom.core.Element;
|
||||
import org.teavm.dom.html.HTMLCanvasElement;
|
||||
import org.teavm.jso.JSArray;
|
||||
import org.teavm.jso.JSArrayReader;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.core.JSArray;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
import org.teavm.jso.dom.html.HTMLCanvasElement;
|
||||
import org.teavm.jso.dom.xml.Element;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.canvas;
|
||||
package org.teavm.jso.canvas;
|
||||
|
||||
import org.teavm.dom.typedarrays.Uint8ClampedArray;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.typedarrays.Uint8ClampedArray;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.canvas;
|
||||
package org.teavm.jso.canvas;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,7 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSFunctor;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.jso;
|
||||
package org.teavm.jso.core;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -68,4 +72,7 @@ public abstract class JSString implements JSObject {
|
|||
public abstract JSString substring(int start);
|
||||
|
||||
public abstract JSString substring(int start, int end);
|
||||
|
||||
@JSBody(params = "obj", script = "return typeof this === 'string';")
|
||||
public static native boolean isInstance(JSObject obj);
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.css;
|
||||
package org.teavm.jso.dom.css;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSObject;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.css;
|
||||
package org.teavm.jso.dom.css;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,12 +13,14 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface DocumentEvent {
|
||||
public interface DocumentEvent extends JSObject {
|
||||
Event createEvent(String eventType);
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.jso.JSFunctor;
|
||||
import org.teavm.jso.JSObject;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.events;
|
||||
package org.teavm.jso.dom.events;
|
||||
|
||||
import org.teavm.dom.browser.Storage;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.browser.Storage;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.dom.events.Event;
|
||||
import org.teavm.dom.events.EventListener;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.events.Event;
|
||||
import org.teavm.jso.dom.events.EventListener;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.w3c.dom.html.HTMLFormElement;
|
|
@ -13,12 +13,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.dom.canvas.CanvasImageSource;
|
||||
import org.teavm.jso.JSMethod;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.canvas.CanvasImageSource;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.dom.core.Element;
|
||||
import org.teavm.jso.JSArrayReader;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
import org.teavm.jso.dom.xml.Element;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.dom.core.Document;
|
||||
import org.teavm.dom.events.EventTarget;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.events.EventTarget;
|
||||
import org.teavm.jso.dom.xml.Document;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,13 +13,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.dom.core.Element;
|
||||
import org.teavm.dom.core.NodeList;
|
||||
import org.teavm.dom.css.ElementCSSInlineStyle;
|
||||
import org.teavm.dom.events.EventTarget;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.css.ElementCSSInlineStyle;
|
||||
import org.teavm.jso.dom.events.EventTarget;
|
||||
import org.teavm.jso.dom.xml.Element;
|
||||
import org.teavm.jso.dom.xml.NodeList;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.dom.canvas.CanvasImageSource;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.canvas.CanvasImageSource;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,24 +13,23 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import java.util.Date;
|
||||
import org.teavm.dom.media.AudioTrackList;
|
||||
import org.teavm.dom.media.MediaController;
|
||||
import org.teavm.dom.media.MediaError;
|
||||
import org.teavm.dom.media.TextTrack;
|
||||
import org.teavm.dom.media.TextTrackList;
|
||||
import org.teavm.dom.media.TimeRanges;
|
||||
import org.teavm.dom.media.VideoTrackList;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.media.AudioTrackList;
|
||||
import org.teavm.jso.media.MediaController;
|
||||
import org.teavm.jso.media.MediaError;
|
||||
import org.teavm.jso.media.TextTrack;
|
||||
import org.teavm.jso.media.TextTrackList;
|
||||
import org.teavm.jso.media.TimeRanges;
|
||||
import org.teavm.jso.media.VideoTrackList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Junji Takakura
|
||||
*/
|
||||
public interface HTMLMediaElement extends HTMLElement {
|
||||
|
||||
int HAVE_NOTHING = 0;
|
||||
int HAVE_METADATA = 1;
|
||||
int HAVE_CURRENT_DATA = 2;
|
||||
|
@ -181,5 +180,4 @@ public interface HTMLMediaElement extends HTMLElement {
|
|||
void load();
|
||||
|
||||
String canPlayType(String type);
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.html;
|
||||
package org.teavm.jso.dom.html;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSArrayReader;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSArrayReader;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.core;
|
||||
package org.teavm.jso.dom.xml;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JSFunctor;
|
||||
import org.teavm.jso.JSObject;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JSMethod;
|
||||
import org.teavm.jso.JSObject;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
|
@ -13,10 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.dom.events.EventTarget;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.dom.events.EventTarget;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
|
@ -13,9 +13,8 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.indexeddb;
|
||||
package org.teavm.jso.indexeddb;
|
||||
|
||||
import org.teavm.jso.JS;
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
|
@ -25,12 +24,15 @@ import org.teavm.jso.JSObject;
|
|||
*/
|
||||
public abstract class IDBFactory implements JSObject {
|
||||
public static boolean isSupported() {
|
||||
return !JS.isUndefined(getInstanceImpl());
|
||||
return !getInstanceImpl().isUndefined();
|
||||
}
|
||||
|
||||
@JSBody(params = {}, script = "return typeof this === 'undefined';")
|
||||
private native boolean isUndefined();
|
||||
|
||||
public static IDBFactory getInstance() {
|
||||
IDBFactory factory = getInstanceImpl();
|
||||
if (JS.isUndefined(factory)) {
|
||||
if (!factory.isUndefined()) {
|
||||
throw new IllegalStateException("IndexedDB is not supported in this browser");
|
||||
}
|
||||
return factory;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user