Package de.inetsoftware.jwebassembly.web
Class JSObject
- java.lang.Object
-
- de.inetsoftware.jwebassembly.web.JSObject
-
- Direct Known Subclasses:
EventTarget
,NodeList
,Window
public class JSObject extends java.lang.Object
The base type for all wrapped JavaScript objects.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JSObject(java.lang.Object peer)
Create a Java instance as wrapper of the JavaScript object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DOMString
domString(java.lang.String str)
Get the dom string from a java string https://developer.mozilla.org/de/docs/Web/API/DOMStringprotected <T> T
get(java.lang.String propName)
Get the value of a property of this object.private static <T> T
get0(java.lang.Object peer, DOMString propName)
Native get a JavaScript property value by name.protected <T> T
invoke(java.lang.String methodName, java.lang.Object param1)
Invoke a JavaScript method with one non string parameter of this object.protected <T> T
invoke(java.lang.String methodName, java.lang.String param1)
Invoke a JavaScript method with one string parameter of this object.private static <T> T
invoke0(java.lang.Object peer, DOMString methodName, java.lang.Object param1)
Native invoke a JavaScript method with one parameter.protected void
set(java.lang.String propName, java.lang.String value)
Set the value of a property of this object.private static void
set0(java.lang.Object peer, DOMString propName, java.lang.Object value)
Native set a JavaScript property value by name.protected static <T> T
win_get(java.lang.String propName)
Get a JavaScript property value by name from global variable window.private static <T> T
win_get0(DOMString propName)
Native get a JavaScript property value by name from global variable window.
-
-
-
Field Detail
-
WEB
private static final java.lang.String WEB
module name for JavaScript helper of the web- See Also:
- Constant Field Values
-
peer
protected final java.lang.Object peer
Native object from JavaScript.
-
-
Method Detail
-
win_get0
private static <T> T win_get0(DOMString propName)
Native get a JavaScript property value by name from global variable window.- Type Parameters:
T
- the return type- Parameters:
propName
- the name of the property as DOMString- Returns:
- the value of the property
-
win_get
protected static <T> T win_get(@Nonnull java.lang.String propName)
Get a JavaScript property value by name from global variable window.- Type Parameters:
T
- the return type- Parameters:
propName
- the name of the property as DOMString- Returns:
- the value of the property
-
get0
private static <T> T get0(java.lang.Object peer, DOMString propName)
Native get a JavaScript property value by name.- Type Parameters:
T
- the return type- Parameters:
peer
- the JavaScript objectpropName
- the name of the property as DOMString- Returns:
- the value of the property
-
get
protected <T> T get(@Nonnull java.lang.String propName)
Get the value of a property of this object.- Type Parameters:
T
- the return type- Parameters:
propName
- the name of the property- Returns:
- the value of the property
-
set0
private static void set0(java.lang.Object peer, @Nonnull DOMString propName, java.lang.Object value)
Native set a JavaScript property value by name.- Parameters:
peer
- the JavaScript objectpropName
- the name of the property as DOMStringvalue
- the value of the property
-
set
protected void set(@Nonnull java.lang.String propName, java.lang.String value)
Set the value of a property of this object.- Parameters:
propName
- the name of the propertyvalue
- the value of the property
-
invoke0
private static <T> T invoke0(java.lang.Object peer, DOMString methodName, java.lang.Object param1)
Native invoke a JavaScript method with one parameter.- Type Parameters:
T
- the return type- Parameters:
peer
- the JavaScript objectmethodName
- the method nameparam1
- the parameter- Returns:
- the return value
-
invoke
protected <T> T invoke(@Nonnull java.lang.String methodName, java.lang.String param1)
Invoke a JavaScript method with one string parameter of this object.- Type Parameters:
T
- the return type- Parameters:
methodName
- the method nameparam1
- the parameter- Returns:
- the return value
-
invoke
protected <T> T invoke(@Nonnull java.lang.String methodName, java.lang.Object param1)
Invoke a JavaScript method with one non string parameter of this object.- Type Parameters:
T
- the return type- Parameters:
methodName
- the method nameparam1
- the parameter- Returns:
- the return value
-
domString
public static DOMString domString(@Nonnull java.lang.String str)
Get the dom string from a java string https://developer.mozilla.org/de/docs/Web/API/DOMString- Parameters:
str
- the Java string- Returns:
- dom string
-
-