mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
jso apis: add missing methods for Array and Object (#686)
This commit is contained in:
parent
4756c9009a
commit
928a8631a8
|
@ -91,6 +91,10 @@ public abstract class JSArray<T extends JSObject> implements JSArrayReader<T> {
|
|||
@NoSideEffects
|
||||
public static native <T extends JSObject> JSArray<T> create(int size);
|
||||
|
||||
@JSBody(params = "object", script = "return Array.isArray(object);")
|
||||
@NoSideEffects
|
||||
public static native boolean isArray(JSObject object);
|
||||
|
||||
@SafeVarargs
|
||||
public static <S extends JSObject> JSArray<S> of(S... items) {
|
||||
JSArray<S> array = create(items.length);
|
||||
|
|
|
@ -27,6 +27,14 @@ public final class JSObjects {
|
|||
@NoSideEffects
|
||||
public static native String[] getOwnPropertyNames(JSObject object);
|
||||
|
||||
@JSBody(params = "object", script = "return Object.keys(object);")
|
||||
@NoSideEffects
|
||||
public static native String[] keys(JSObject object);
|
||||
|
||||
@JSBody(params = "object", script = "return Object.values(object);")
|
||||
@NoSideEffects
|
||||
public static native JSObject[] values(JSObject object);
|
||||
|
||||
@JSBody(script = "return {};")
|
||||
@NoSideEffects
|
||||
public static native <T extends JSObject> T create();
|
||||
|
|
Loading…
Reference in New Issue
Block a user