mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Starting to refactor JSO
This commit is contained in:
parent
b4ba3719d0
commit
ac5d53ef08
|
@ -19,9 +19,8 @@ import org.teavm.dom.ajax.XMLHttpRequest;
|
||||||
import org.teavm.dom.events.EventTarget;
|
import org.teavm.dom.events.EventTarget;
|
||||||
import org.teavm.dom.html.HTMLDocument;
|
import org.teavm.dom.html.HTMLDocument;
|
||||||
import org.teavm.dom.json.JSON;
|
import org.teavm.dom.json.JSON;
|
||||||
import org.teavm.dom.typedarrays.*;
|
import org.teavm.dom.typedarrays.TypedArrayFactory;
|
||||||
import org.teavm.jso.JSConstructor;
|
import org.teavm.jso.JSConstructor;
|
||||||
import org.teavm.jso.JSGlobal;
|
|
||||||
import org.teavm.jso.JSObject;
|
import org.teavm.jso.JSObject;
|
||||||
import org.teavm.jso.JSProperty;
|
import org.teavm.jso.JSProperty;
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ import org.teavm.jso.JSProperty;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public interface Window extends JSGlobal, EventTarget, StorageProvider, TypedArrayFactory {
|
public interface Window extends JSObject, EventTarget, StorageProvider, TypedArrayFactory {
|
||||||
@JSProperty
|
@JSProperty
|
||||||
HTMLDocument getDocument();
|
HTMLDocument getDocument();
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
package org.teavm.dom.indexeddb;
|
package org.teavm.dom.indexeddb;
|
||||||
|
|
||||||
import org.teavm.jso.JS;
|
import org.teavm.jso.JS;
|
||||||
|
import org.teavm.jso.JSBody;
|
||||||
import org.teavm.jso.JSObject;
|
import org.teavm.jso.JSObject;
|
||||||
import org.teavm.jso.JSProperty;
|
import org.teavm.jso.JSProperty;
|
||||||
import org.teavm.jso.JSStringArray;
|
|
||||||
import org.teavm.jso.JSType;
|
import org.teavm.jso.JSType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,10 +37,13 @@ public abstract class IDBIndex implements JSObject, IDBCursorSource {
|
||||||
if (JS.getType(result) == JSType.STRING) {
|
if (JS.getType(result) == JSType.STRING) {
|
||||||
return new String[] { JS.unwrapString(result) };
|
return new String[] { JS.unwrapString(result) };
|
||||||
} else {
|
} else {
|
||||||
return JS.unwrapStringArray((JSStringArray) result);
|
return unwrapStringArray(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JSBody(params = {}, script = "return this;")
|
||||||
|
private native String[] unwrapStringArray(JSObject obj);
|
||||||
|
|
||||||
@JSProperty
|
@JSProperty
|
||||||
public abstract boolean isMultiEntry();
|
public abstract boolean isMultiEntry();
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,13 @@ public abstract class IDBObjectStore implements JSObject, IDBCursorSource {
|
||||||
if (JS.getType(result) == JSType.STRING) {
|
if (JS.getType(result) == JSType.STRING) {
|
||||||
return new String[] { JS.unwrapString(result) };
|
return new String[] { JS.unwrapString(result) };
|
||||||
} else {
|
} else {
|
||||||
return JS.unwrapStringArray((JSStringArray) result);
|
return unwrapStringArray(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JSBody(params = {}, script = "return this;")
|
||||||
|
private native String[] unwrapStringArray(JSObject obj);
|
||||||
|
|
||||||
@JSProperty
|
@JSProperty
|
||||||
public abstract String[] getIndexNames();
|
public abstract String[] getIndexNames();
|
||||||
|
|
||||||
|
|
|
@ -49,34 +49,14 @@ public final class JS {
|
||||||
throw new AssertionError("Unexpected type");
|
throw new AssertionError("Unexpected type");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends JSObject> JSArray<T> createArray(int size) {
|
@JSExpression(params = "obj", expr = "typeof(obj)")
|
||||||
return ((JSGlobal) JS.getGlobal()).newArray(size);
|
private static native JSObject getTypeName(JSObject obj);
|
||||||
}
|
|
||||||
|
|
||||||
public static JSIntArray createIntArray(int size) {
|
|
||||||
return ((JSGlobal) JS.getGlobal()).newIntArray(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JSStringArray createStringArray(int size) {
|
|
||||||
return ((JSGlobal) JS.getGlobal()).newStringArray(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JSBooleanArray createBooleanArray(int size) {
|
|
||||||
return ((JSGlobal) JS.getGlobal()).newBooleanArray(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JSDoubleArray createDoubleArray(int size) {
|
|
||||||
return ((JSGlobal) JS.getGlobal()).newDoubleArray(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject getTypeName(JSObject obj);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets global JavaScript object, that is similar to the <code>window</code> object in the browser.
|
* Gets global JavaScript object, that is similar to the <code>window</code> object in the browser.
|
||||||
* @return global object.
|
* @return global object.
|
||||||
*/
|
*/
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@JSExpression(params = "obj", expr = "window")
|
||||||
public static native JSObject getGlobal();
|
public static native JSObject getGlobal();
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
|
@ -85,29 +65,11 @@ public final class JS {
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
public static native JSObject wrap(char c);
|
public static native JSObject wrap(char c);
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject wrap(int num);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject wrap(float num);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject wrap(double num);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject wrap(boolean num);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject wrap(byte num);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject wrap(short num);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
public static native JSObject marshall(Object obj);
|
public static native JSObject marshall(Object obj);
|
||||||
|
|
||||||
public static <T extends JSObject> JSArray<T> wrap(T[] array) {
|
public static <T extends JSObject> JSArray<T> wrap(T[] array) {
|
||||||
JSArray<T> result = createArray(array.length);
|
JSArray<T> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, array[i]);
|
result.set(i, array[i]);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +77,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends JSObject> JSArray<JSArray<T>> wrap(T[][] array) {
|
public static <T extends JSObject> JSArray<JSArray<T>> wrap(T[][] array) {
|
||||||
JSArray<JSArray<T>> result = createArray(array.length);
|
JSArray<JSArray<T>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -123,71 +85,71 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends JSObject> JSArray<JSArray<JSArray<T>>> wrap(T[][][] array) {
|
public static <T extends JSObject> JSArray<JSArray<JSArray<T>>> wrap(T[][][] array) {
|
||||||
JSArray<JSArray<JSArray<T>>> result = createArray(array.length);
|
JSArray<JSArray<JSArray<T>>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSBooleanArray wrap(boolean[] array) {
|
public static JSArray<JSBoolean> wrap(boolean[] array) {
|
||||||
JSBooleanArray result = createBooleanArray(array.length);
|
JSArray<JSBoolean> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, array[i]);
|
result.set(i, JSBoolean.valueOf(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSBooleanArray> wrap(boolean[][] array) {
|
public static JSArray<JSArray<JSBoolean>> wrap(boolean[][] array) {
|
||||||
JSArray<JSBooleanArray> result = createArray(array.length);
|
JSArray<JSArray<JSBoolean>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSBooleanArray>> wrap(boolean[][][] array) {
|
public static JSArray<JSArray<JSArray<JSBoolean>>> wrap(boolean[][][] array) {
|
||||||
JSArray<JSArray<JSBooleanArray>> result = createArray(array.length);
|
JSArray<JSArray<JSArray<JSBoolean>>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSIntArray wrap(byte[] array) {
|
public static JSArray<JSNumber> wrap(byte[] array) {
|
||||||
JSIntArray result = createIntArray(array.length);
|
JSArray<JSNumber> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, array[i]);
|
result.set(i, JSNumber.valueOf(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSIntArray> wrap(byte[][] array) {
|
public static JSArray<JSArray<JSNumber>> wrap(byte[][] array) {
|
||||||
JSArray<JSIntArray> result = createArray(array.length);
|
JSArray<JSArray<JSNumber>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSIntArray>> wrap(byte[][][] array) {
|
public static JSArray<JSArray<JSArray<JSNumber>>> wrap(byte[][][] array) {
|
||||||
JSArray<JSArray<JSIntArray>> result = createArray(array.length);
|
JSArray<JSArray<JSArray<JSNumber>>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSIntArray wrap(short[] array) {
|
public static JSArray<JSNumber> wrap(short[] array) {
|
||||||
JSIntArray result = createIntArray(array.length);
|
JSArray<JSNumber> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, array[i]);
|
result.set(i, JSNumber.valueOf(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSIntArray> wrap(short[][] array) {
|
public static JSArray<JSIntArray> wrap(short[][] array) {
|
||||||
JSArray<JSIntArray> result = createArray(array.length);
|
JSArray<JSIntArray> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -195,7 +157,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSIntArray>> wrap(short[][][] array) {
|
public static JSArray<JSArray<JSIntArray>> wrap(short[][][] array) {
|
||||||
JSArray<JSArray<JSIntArray>> result = createArray(array.length);
|
JSArray<JSArray<JSIntArray>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -211,7 +173,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSIntArray> wrap(char[][] array) {
|
public static JSArray<JSIntArray> wrap(char[][] array) {
|
||||||
JSArray<JSIntArray> result = createArray(array.length);
|
JSArray<JSIntArray> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -219,7 +181,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSIntArray>> wrap(char[][][] array) {
|
public static JSArray<JSArray<JSIntArray>> wrap(char[][][] array) {
|
||||||
JSArray<JSArray<JSIntArray>> result = createArray(array.length);
|
JSArray<JSArray<JSIntArray>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -235,7 +197,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSIntArray> wrap(int[][] array) {
|
public static JSArray<JSIntArray> wrap(int[][] array) {
|
||||||
JSArray<JSIntArray> result = createArray(array.length);
|
JSArray<JSIntArray> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -243,7 +205,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSIntArray>> wrap(int[][][] array) {
|
public static JSArray<JSArray<JSIntArray>> wrap(int[][][] array) {
|
||||||
JSArray<JSArray<JSIntArray>> result = createArray(array.length);
|
JSArray<JSArray<JSIntArray>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -251,7 +213,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSStringArray wrap(String[] array) {
|
public static JSStringArray wrap(String[] array) {
|
||||||
JSStringArray result = createStringArray(array.length);
|
JSStringArray result = JSStringArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, array[i]);
|
result.set(i, array[i]);
|
||||||
}
|
}
|
||||||
|
@ -259,7 +221,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSStringArray> wrap(String[][] array) {
|
public static JSArray<JSStringArray> wrap(String[][] array) {
|
||||||
JSArray<JSStringArray> result = createArray(array.length);
|
JSArray<JSStringArray> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -267,7 +229,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSStringArray>> wrap(String[][][] array) {
|
public static JSArray<JSArray<JSStringArray>> wrap(String[][][] array) {
|
||||||
JSArray<JSArray<JSStringArray>> result = createArray(array.length);
|
JSArray<JSArray<JSStringArray>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -283,7 +245,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSDoubleArray> wrap(float[][] array) {
|
public static JSArray<JSDoubleArray> wrap(float[][] array) {
|
||||||
JSArray<JSDoubleArray> result = createArray(array.length);
|
JSArray<JSDoubleArray> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -291,7 +253,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSDoubleArray>> wrap(float[][][] array) {
|
public static JSArray<JSArray<JSDoubleArray>> wrap(float[][][] array) {
|
||||||
JSArray<JSArray<JSDoubleArray>> result = createArray(array.length);
|
JSArray<JSArray<JSDoubleArray>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -307,7 +269,7 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSDoubleArray> wrap(double[][] array) {
|
public static JSArray<JSDoubleArray> wrap(double[][] array) {
|
||||||
JSArray<JSDoubleArray> result = createArray(array.length);
|
JSArray<JSDoubleArray> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
|
@ -315,33 +277,13 @@ public final class JS {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSArray<JSArray<JSDoubleArray>> wrap(double[][][] array) {
|
public static JSArray<JSArray<JSDoubleArray>> wrap(double[][][] array) {
|
||||||
JSArray<JSArray<JSDoubleArray>> result = createArray(array.length);
|
JSArray<JSArray<JSDoubleArray>> result = JSArray.create(array.length);
|
||||||
for (int i = 0; i < array.length; ++i) {
|
for (int i = 0; i < array.length; ++i) {
|
||||||
result.set(i, wrap(array[i]));
|
result.set(i, wrap(array[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native boolean unwrapBoolean(JSObject obj);
|
|
||||||
|
|
||||||
public static byte unwrapByte(JSObject obj) {
|
|
||||||
return (byte) unwrapInt(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static short unwrapShort(JSObject obj) {
|
|
||||||
return (short) unwrapInt(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native int unwrapInt(JSObject obj);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native float unwrapFloat(JSObject obj);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native double unwrapDouble(JSObject obj);
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native String unwrapString(JSObject obj);
|
public static native String unwrapString(JSObject obj);
|
||||||
|
@ -377,101 +319,101 @@ public final class JS {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] unwrapStringArray(JSStringArray array) {
|
@JSExpression(params = "obj", expr = "typeof(obj) === 'undefined'")
|
||||||
String[] result = new String[array.getLength()];
|
|
||||||
for (int i = 0; i < result.length; ++i) {
|
|
||||||
result[i] = array.get(i);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String[][] unwrapStringArray2(JSArray<JSStringArray> array) {
|
|
||||||
String[][] result = new String[array.getLength()][];
|
|
||||||
for (int i = 0; i < result.length; ++i) {
|
|
||||||
result[i] = unwrapStringArray(array.get(i));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String[][][] unwrapStringArray3(JSArray<JSArray<JSStringArray>> array) {
|
|
||||||
String[][][] result = new String[array.getLength()][][];
|
|
||||||
for (int i = 0; i < result.length; ++i) {
|
|
||||||
result[i] = unwrapStringArray2(array.get(i));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native boolean isUndefined(JSObject obj);
|
public static native boolean isUndefined(JSObject obj);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method" }, expr = "instance[method]()")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method);
|
public static native JSObject invoke(JSObject instance, JSObject method);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a" }, expr = "instance[method](a)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a);
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b" }, expr = "instance[method](a, b)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b);
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c" }, expr = "instance[method](a, b, c)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c);
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d" }, expr = "instance[method](a, b, c, d)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d);
|
JSObject d);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e" }, expr = "instance[method](a, b, c, d, e)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e);
|
JSObject d, JSObject e);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f);
|
JSObject d, JSObject e, JSObject f);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g);
|
JSObject d, JSObject e, JSObject f, JSObject g);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g", "h" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g, h)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h);
|
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g", "h", "i" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g, h, i)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i);
|
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g, h, i, j)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j);
|
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g, h, i, j, k)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k);
|
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g, h, i, j, k, l)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k,
|
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k,
|
||||||
JSObject l);
|
JSObject l);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m" },
|
||||||
|
expr = "instance[method](a, b, c, d, e, f, g, h, i, j, k, l, m)")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k,
|
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k,
|
||||||
JSObject l, JSObject m);
|
JSObject l, JSObject m);
|
||||||
|
|
||||||
|
@JSExpression(params = { "instance", "method" },
|
||||||
|
expr = "new instance[method]()")
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
@PluggableDependency(JSNativeGenerator.class)
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native JSObject instantiate(JSObject instance, JSObject constructor);
|
public static native JSObject instantiate(JSObject instance, JSObject constructor);
|
||||||
|
@ -529,25 +471,11 @@ public final class JS {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Iterable<String> iterate(final JSStringArrayReader array) {
|
@JSExpression(params = { "instance", "index" }, expr = "instance[index]")
|
||||||
return () -> new Iterator<String>() {
|
|
||||||
int index;
|
|
||||||
@Override public boolean hasNext() {
|
|
||||||
return index < array.getLength();
|
|
||||||
}
|
|
||||||
@Override public String next() {
|
|
||||||
return array.get(index++);
|
|
||||||
}
|
|
||||||
@Override public void remove() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
|
||||||
public static native JSObject get(JSObject instance, JSObject index);
|
public static native JSObject get(JSObject instance, JSObject index);
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
|
@JSExpression(params = { "instance", "index", "obj" }, expr = "instance[index] = obj")
|
||||||
public static native void set(JSObject instance, JSObject index, JSObject obj);
|
public static native void set(JSObject instance, JSObject index, JSObject obj);
|
||||||
|
|
||||||
@GeneratedBy(JSNativeGenerator.class)
|
@GeneratedBy(JSNativeGenerator.class)
|
||||||
|
|
|
@ -20,59 +20,68 @@ package org.teavm.jso;
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public interface JSArray<T extends JSObject> extends JSArrayReader<T> {
|
public abstract class JSArray<T extends JSObject> implements JSArrayReader<T> {
|
||||||
|
private JSArray() {
|
||||||
|
}
|
||||||
|
|
||||||
@JSIndexer
|
@JSIndexer
|
||||||
void set(int index, T value);
|
public abstract void set(int index, T value);
|
||||||
|
|
||||||
int push(T a);
|
public abstract int push(T a);
|
||||||
|
|
||||||
int push(T a, T b);
|
public abstract int push(T a, T b);
|
||||||
|
|
||||||
int push(T a, T b, T c);
|
public abstract int push(T a, T b, T c);
|
||||||
|
|
||||||
int push(T a, T b, T c, T d);
|
public abstract int push(T a, T b, T c, T d);
|
||||||
|
|
||||||
T shift();
|
public abstract T shift();
|
||||||
|
|
||||||
String join(String separator);
|
public abstract String join(String separator);
|
||||||
|
|
||||||
String join();
|
public abstract String join();
|
||||||
|
|
||||||
JSArray<T> concat(JSArrayReader<T> a);
|
public abstract JSArray<T> concat(JSArrayReader<T> a);
|
||||||
|
|
||||||
JSArray<T> concat(JSArrayReader<T> a, JSArrayReader<T> b);
|
public abstract JSArray<T> concat(JSArrayReader<T> a, JSArrayReader<T> b);
|
||||||
|
|
||||||
JSArray<T> concat(JSArrayReader<T> a, JSArrayReader<T> b, JSArrayReader<T> c);
|
public abstract JSArray<T> concat(JSArrayReader<T> a, JSArrayReader<T> b, JSArrayReader<T> c);
|
||||||
|
|
||||||
JSArray<T> concat(JSArrayReader<T> a, JSArrayReader<T> b, JSArrayReader<T> c, JSArrayReader<T> d);
|
public abstract JSArray<T> concat(JSArrayReader<T> a, JSArrayReader<T> b, JSArrayReader<T> c, JSArrayReader<T> d);
|
||||||
|
|
||||||
T pop();
|
public abstract T pop();
|
||||||
|
|
||||||
int unshift(T a);
|
public abstract int unshift(T a);
|
||||||
|
|
||||||
int unshift(T a, T b);
|
public abstract int unshift(T a, T b);
|
||||||
|
|
||||||
int unshift(T a, T b, T c);
|
public abstract int unshift(T a, T b, T c);
|
||||||
|
|
||||||
int unshift(T a, T b, T c, T d);
|
public abstract int unshift(T a, T b, T c, T d);
|
||||||
|
|
||||||
JSArray<T> slice(int start);
|
public abstract JSArray<T> slice(int start);
|
||||||
|
|
||||||
JSArray<T> slice(int start, int end);
|
public abstract JSArray<T> slice(int start, int end);
|
||||||
|
|
||||||
JSArray<T> reverse();
|
public abstract JSArray<T> reverse();
|
||||||
|
|
||||||
JSArray<T> sort(JSSortFunction<T> function);
|
public abstract JSArray<T> sort(JSSortFunction<T> function);
|
||||||
|
|
||||||
JSArray<T> sort();
|
public abstract JSArray<T> sort();
|
||||||
|
|
||||||
JSArray<T> splice(int start, int count);
|
public abstract JSArray<T> splice(int start, int count);
|
||||||
|
|
||||||
JSArray<T> splice(int start, int count, T a);
|
public abstract JSArray<T> splice(int start, int count, T a);
|
||||||
|
|
||||||
JSArray<T> splice(int start, int count, T a, T b);
|
public abstract JSArray<T> splice(int start, int count, T a, T b);
|
||||||
|
|
||||||
JSArray<T> splice(int start, int count, T a, T b, T c);
|
public abstract JSArray<T> splice(int start, int count, T a, T b, T c);
|
||||||
|
|
||||||
JSArray<T> splice(int start, int count, T a, T b, T c, T d);
|
public abstract JSArray<T> splice(int start, int count, T a, T b, T c, T d);
|
||||||
|
|
||||||
|
@JSExpression(params = {}, expr = "new Array()")
|
||||||
|
public static native <T extends JSObject> JSArray<T> create();
|
||||||
|
|
||||||
|
@JSExpression(params = "size", expr = "new Array(size)")
|
||||||
|
public static native <T extends JSObject> JSArray<T> create(int size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,17 @@ package org.teavm.jso;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public interface JSIntArrayReader extends JSObject {
|
public abstract class JSBoolean implements JSObject {
|
||||||
@JSProperty
|
private JSBoolean() {
|
||||||
int getLength();
|
}
|
||||||
|
|
||||||
@JSIndexer
|
public final boolean booleanValue() {
|
||||||
int get(int index);
|
return booleanValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
private static native boolean booleanValue(JSBoolean value);
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
public static native JSBoolean valueOf(boolean value);
|
||||||
}
|
}
|
|
@ -1,73 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSBooleanArray extends JSBooleanArrayReader {
|
|
||||||
@JSIndexer
|
|
||||||
void set(int index, boolean value);
|
|
||||||
|
|
||||||
int push(boolean a);
|
|
||||||
|
|
||||||
int push(boolean a, boolean b);
|
|
||||||
|
|
||||||
int push(boolean a, boolean b, boolean c);
|
|
||||||
|
|
||||||
int push(boolean a, boolean b, boolean c, boolean d);
|
|
||||||
|
|
||||||
boolean shift();
|
|
||||||
|
|
||||||
String join(String separator);
|
|
||||||
|
|
||||||
String join();
|
|
||||||
|
|
||||||
JSBooleanArray concat(JSBooleanArrayReader a);
|
|
||||||
|
|
||||||
JSBooleanArray concat(JSBooleanArray a, JSBooleanArray b);
|
|
||||||
|
|
||||||
JSBooleanArray concat(JSBooleanArray a, JSBooleanArray b, JSBooleanArray c);
|
|
||||||
|
|
||||||
JSBooleanArray concat(JSBooleanArray a, JSBooleanArray b, JSBooleanArray c, JSBooleanArray d);
|
|
||||||
|
|
||||||
boolean pop();
|
|
||||||
|
|
||||||
int unshift(boolean a);
|
|
||||||
|
|
||||||
int unshift(boolean a, boolean b);
|
|
||||||
|
|
||||||
int unshift(boolean a, boolean b, boolean c);
|
|
||||||
|
|
||||||
int unshift(boolean a, boolean b, boolean c, boolean d);
|
|
||||||
|
|
||||||
JSBooleanArray slice(int start);
|
|
||||||
|
|
||||||
JSBooleanArray slice(int start, int end);
|
|
||||||
|
|
||||||
JSBooleanArray reverse();
|
|
||||||
|
|
||||||
JSBooleanArray splice(int start, int count);
|
|
||||||
|
|
||||||
JSBooleanArray splice(int start, int count, boolean a);
|
|
||||||
|
|
||||||
JSBooleanArray splice(int start, int count, boolean a, boolean b);
|
|
||||||
|
|
||||||
JSBooleanArray splice(int start, int count, boolean a, boolean b, boolean c);
|
|
||||||
|
|
||||||
JSBooleanArray splice(int start, int count, boolean a, boolean b, boolean c, boolean d);
|
|
||||||
}
|
|
|
@ -1,28 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSBooleanArrayReader extends JSObject {
|
|
||||||
@JSProperty
|
|
||||||
int getLength();
|
|
||||||
|
|
||||||
@JSIndexer
|
|
||||||
boolean get(int index);
|
|
||||||
}
|
|
|
@ -1,28 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSByteArrayReader extends JSObject {
|
|
||||||
@JSProperty
|
|
||||||
int getLength();
|
|
||||||
|
|
||||||
@JSIndexer
|
|
||||||
byte get(int index);
|
|
||||||
}
|
|
|
@ -1,77 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSDoubleArray extends JSDoubleArrayReader {
|
|
||||||
@JSIndexer
|
|
||||||
void set(int index, double value);
|
|
||||||
|
|
||||||
int push(double a);
|
|
||||||
|
|
||||||
int push(double a, double b);
|
|
||||||
|
|
||||||
int push(double a, double b, double c);
|
|
||||||
|
|
||||||
int push(double a, double b, double c, double d);
|
|
||||||
|
|
||||||
double shift();
|
|
||||||
|
|
||||||
String join(String separator);
|
|
||||||
|
|
||||||
String join();
|
|
||||||
|
|
||||||
JSDoubleArray concat(JSDoubleArrayReader a);
|
|
||||||
|
|
||||||
JSDoubleArray concat(JSDoubleArray a, JSDoubleArray b);
|
|
||||||
|
|
||||||
JSDoubleArray concat(JSDoubleArray a, JSDoubleArray b, JSDoubleArray c);
|
|
||||||
|
|
||||||
JSDoubleArray concat(JSDoubleArray a, JSDoubleArray b, JSDoubleArray c, JSDoubleArray d);
|
|
||||||
|
|
||||||
double pop();
|
|
||||||
|
|
||||||
int unshift(double a);
|
|
||||||
|
|
||||||
int unshift(double a, double b);
|
|
||||||
|
|
||||||
int unshift(double a, double b, double c);
|
|
||||||
|
|
||||||
int unshift(double a, double b, double c, double d);
|
|
||||||
|
|
||||||
JSDoubleArray slice(int start);
|
|
||||||
|
|
||||||
JSDoubleArray slice(int start, int end);
|
|
||||||
|
|
||||||
JSDoubleArray reverse();
|
|
||||||
|
|
||||||
JSDoubleArray sort(JSDoubleSortFunction function);
|
|
||||||
|
|
||||||
JSDoubleArray sort();
|
|
||||||
|
|
||||||
JSDoubleArray splice(int start, int count);
|
|
||||||
|
|
||||||
JSDoubleArray splice(int start, int count, double a);
|
|
||||||
|
|
||||||
JSDoubleArray splice(int start, int count, double a, double b);
|
|
||||||
|
|
||||||
JSDoubleArray splice(int start, int count, double a, double b, double c);
|
|
||||||
|
|
||||||
JSDoubleArray splice(int start, int count, double a, double b, double c, double d);
|
|
||||||
}
|
|
|
@ -1,28 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSDoubleArrayReader extends JSObject {
|
|
||||||
@JSProperty
|
|
||||||
int getLength();
|
|
||||||
|
|
||||||
@JSIndexer
|
|
||||||
double get(int index);
|
|
||||||
}
|
|
|
@ -1,25 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
@JSFunctor
|
|
||||||
public interface JSDoubleSortFunction {
|
|
||||||
int compare(double a, double b);
|
|
||||||
}
|
|
41
teavm-jso/src/main/java/org/teavm/jso/JSExpression.java
Normal file
41
teavm-jso/src/main/java/org/teavm/jso/JSExpression.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* 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.jso;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Indicates that method is to have native JavaScript implementation, which can be written as a
|
||||||
|
* single JavaScript expression.
|
||||||
|
* Method only can take and return primitive values and {@link JSObject}s.
|
||||||
|
* JSExpression script can't call Java methods, but you can pass callbacks wrapped into {@link JSFunctor}.
|
||||||
|
* Note that unless method is static, it must belong to class that implements {@link JSObject}.
|
||||||
|
* If applied to non-native method, original Java body will be overwritten by JavaScript.</p>
|
||||||
|
*
|
||||||
|
* <p>Use this annotation instead of JSBody when possible, since this can increase performance and
|
||||||
|
* reduce generated JavaScript size.</p>
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev
|
||||||
|
*/
|
||||||
|
public @interface JSExpression {
|
||||||
|
/**
|
||||||
|
* <p>How method parameters are named inside JavaScript implementation.</p>
|
||||||
|
*/
|
||||||
|
String[] params();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>JavaScript expression.</p>
|
||||||
|
*/
|
||||||
|
String expr();
|
||||||
|
}
|
|
@ -1,55 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSGlobal extends JSObject {
|
|
||||||
@JSConstructor
|
|
||||||
JSObject newObject();
|
|
||||||
|
|
||||||
@JSConstructor
|
|
||||||
<T extends JSObject> JSArray<T> newArray();
|
|
||||||
|
|
||||||
@JSConstructor
|
|
||||||
<T extends JSObject> JSArray<T> newArray(int sz);
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSStringArray newStringArray();
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSStringArray newStringArray(int sz);
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSBooleanArray newBooleanArray();
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSBooleanArray newBooleanArray(int sz);
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSIntArray newIntArray();
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSIntArray newIntArray(int sz);
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSDoubleArray newDoubleArray();
|
|
||||||
|
|
||||||
@JSConstructor("Array")
|
|
||||||
JSDoubleArray newDoubleArray(int sz);
|
|
||||||
}
|
|
|
@ -1,77 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSIntArray extends JSIntArrayReader {
|
|
||||||
@JSIndexer
|
|
||||||
void set(int index, int value);
|
|
||||||
|
|
||||||
int push(int a);
|
|
||||||
|
|
||||||
int push(int a, int b);
|
|
||||||
|
|
||||||
int push(int a, int b, int c);
|
|
||||||
|
|
||||||
int push(int a, int b, int c, int d);
|
|
||||||
|
|
||||||
int shift();
|
|
||||||
|
|
||||||
int join(int separator);
|
|
||||||
|
|
||||||
int join();
|
|
||||||
|
|
||||||
JSIntArray concat(JSIntArrayReader a);
|
|
||||||
|
|
||||||
JSIntArray concat(JSIntArrayReader a, JSIntArrayReader b);
|
|
||||||
|
|
||||||
JSIntArray concat(JSIntArrayReader a, JSIntArrayReader b, JSIntArrayReader c);
|
|
||||||
|
|
||||||
JSIntArray concat(JSIntArrayReader a, JSIntArrayReader b, JSIntArrayReader c, JSIntArrayReader d);
|
|
||||||
|
|
||||||
int pop();
|
|
||||||
|
|
||||||
int unshift(int a);
|
|
||||||
|
|
||||||
int unshift(int a, int b);
|
|
||||||
|
|
||||||
int unshift(int a, int b, int c);
|
|
||||||
|
|
||||||
int unshift(int a, int b, int c, int d);
|
|
||||||
|
|
||||||
JSIntArray slice(int start);
|
|
||||||
|
|
||||||
JSIntArray slice(int start, int end);
|
|
||||||
|
|
||||||
JSIntArray reverse();
|
|
||||||
|
|
||||||
JSIntArray sort(JSIntSortFunction function);
|
|
||||||
|
|
||||||
JSIntArray sort();
|
|
||||||
|
|
||||||
JSIntArray splice(int start, int count);
|
|
||||||
|
|
||||||
JSIntArray splice(int start, int count, int a);
|
|
||||||
|
|
||||||
JSIntArray splice(int start, int count, int a, int b);
|
|
||||||
|
|
||||||
JSIntArray splice(int start, int count, int a, int b, int c);
|
|
||||||
|
|
||||||
JSIntArray splice(int start, int count, int a, int b, int c, int d);
|
|
||||||
}
|
|
|
@ -1,25 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
@JSFunctor
|
|
||||||
public interface JSIntSortFunction extends JSObject {
|
|
||||||
int compare(int a, int b);
|
|
||||||
}
|
|
|
@ -19,5 +19,57 @@ package org.teavm.jso;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public interface JSNumber extends JSObject {
|
public abstract class JSNumber implements JSObject {
|
||||||
|
private JSNumber() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final double doubleValue() {
|
||||||
|
return doubleValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExpression(params = "number", expr = "number")
|
||||||
|
private static native double doubleValue(JSNumber number);
|
||||||
|
|
||||||
|
public final int intValue() {
|
||||||
|
return intValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExpression(params = "number", expr = "number")
|
||||||
|
private static native int intValue(JSNumber number);
|
||||||
|
|
||||||
|
public final byte byteValue() {
|
||||||
|
return byteValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExpression(params = "number", expr = "number")
|
||||||
|
private static native byte byteValue(JSNumber number);
|
||||||
|
|
||||||
|
public final short shortValue() {
|
||||||
|
return shortValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExpression(params = "number", expr = "number")
|
||||||
|
private static native short shortValue(JSNumber number);
|
||||||
|
|
||||||
|
public final float floatValue() {
|
||||||
|
return floatValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExpression(params = "number", expr = "number")
|
||||||
|
private static native float floatValue(JSNumber number);
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
public static native JSNumber valueOf(byte value);
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
public static native JSNumber valueOf(short value);
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
public static native JSNumber valueOf(int value);
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
public static native JSNumber valueOf(float value);
|
||||||
|
|
||||||
|
@JSExpression(params = "value", expr = "value")
|
||||||
|
public static native JSNumber valueOf(double value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSShortArrayReader extends JSObject {
|
|
||||||
@JSProperty
|
|
||||||
int getLength();
|
|
||||||
|
|
||||||
@JSIndexer
|
|
||||||
short get(int index);
|
|
||||||
}
|
|
|
@ -1,77 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSStringArray extends JSStringArrayReader {
|
|
||||||
@JSIndexer
|
|
||||||
void set(int index, String value);
|
|
||||||
|
|
||||||
int push(String a);
|
|
||||||
|
|
||||||
int push(String a, String b);
|
|
||||||
|
|
||||||
int push(String a, String b, String c);
|
|
||||||
|
|
||||||
int push(String a, String b, String c, String d);
|
|
||||||
|
|
||||||
String shift();
|
|
||||||
|
|
||||||
String join(String separator);
|
|
||||||
|
|
||||||
String join();
|
|
||||||
|
|
||||||
JSStringArray concat(JSStringArrayReader a);
|
|
||||||
|
|
||||||
JSStringArray concat(JSStringArrayReader a, JSStringArrayReader b);
|
|
||||||
|
|
||||||
JSStringArray concat(JSStringArrayReader a, JSStringArrayReader b, JSStringArrayReader c);
|
|
||||||
|
|
||||||
JSStringArray concat(JSStringArrayReader a, JSStringArrayReader b, JSStringArrayReader c, JSStringArrayReader d);
|
|
||||||
|
|
||||||
String pop();
|
|
||||||
|
|
||||||
int unshift(String a);
|
|
||||||
|
|
||||||
int unshift(String a, String b);
|
|
||||||
|
|
||||||
int unshift(String a, String b, String c);
|
|
||||||
|
|
||||||
int unshift(String a, String b, String c, String d);
|
|
||||||
|
|
||||||
JSStringArray slice(int start);
|
|
||||||
|
|
||||||
JSStringArray slice(int start, int end);
|
|
||||||
|
|
||||||
JSStringArray reverse();
|
|
||||||
|
|
||||||
JSStringArray sort(JSStringSortFunction function);
|
|
||||||
|
|
||||||
JSStringArray sort();
|
|
||||||
|
|
||||||
JSStringArray splice(int start, int count);
|
|
||||||
|
|
||||||
JSStringArray splice(int start, int count, String a);
|
|
||||||
|
|
||||||
JSStringArray splice(int start, int count, String a, String b);
|
|
||||||
|
|
||||||
JSStringArray splice(int start, int count, String a, String b, String c);
|
|
||||||
|
|
||||||
JSStringArray splice(int start, int count, String a, String b, String c, String d);
|
|
||||||
}
|
|
|
@ -1,28 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
public interface JSStringArrayReader extends JSObject {
|
|
||||||
@JSProperty
|
|
||||||
int getLength();
|
|
||||||
|
|
||||||
@JSIndexer
|
|
||||||
String get(int index);
|
|
||||||
}
|
|
|
@ -1,25 +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.jso;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Alexey Andreev
|
|
||||||
*/
|
|
||||||
@JSFunctor
|
|
||||||
public interface JSStringSortFunction extends JSObject {
|
|
||||||
int compare(String a, String b);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user