public final class JsHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
<T> T |
cast(Object object)
Performs unchecked cast to a type.
Using this method can have an incorrect type of the object to the rest of the system which will result in hard to debug problems. |
MutationObserverInit |
createMutationObserverInit()
Creates new instance of observer initialization options.
|
static JsHelper |
get()
Singleton object to get the helper instance
|
boolean |
getBooleanProperty(Key key,
NativeObject nativeObject)
Returns the property value from java script object, when it is stored as boolean.
|
int |
getIntegerProperty(Key key,
NativeObject nativeObject)
Returns the property value from java script object, when it is stored as integer.
|
String |
getStringProperty(Key key,
NativeObject nativeObject)
Returns the property value from java script object, when the ID is stored as string.
|
boolean |
has(Object object,
String key)
Returns a boolean indicating whether the object has the specified property as its own property.
|
boolean |
isCanvas(NativeObjectContainer object,
Key key)
Returns
true if the object is a Canvas. |
boolean |
isCanvasGradient(Object object)
Returns
true if the object is a CanvasGradientItem. |
boolean |
isCanvasPattern(Object object)
Returns
true if the object is a CanvasPatternItem. |
boolean |
isImage(NativeObjectContainer object,
Key key)
Returns
true if the object is a Img. |
<T> CallbackProxy<T> |
newCallbackProxy()
Creates new proxy for callback which will pass
this environment of java script as first argument of callback method. |
ObjectType |
typeOf(Object object)
Returns the java script object type of object.
|
ObjectType |
typeOf(Object object,
String key)
Returns the java script object type of a property.
|
public static JsHelper get()
public <T> T cast(Object object)
T - type of the resultobject - object which must be castpublic MutationObserverInit createMutationObserverInit()
public boolean has(Object object, String key)
object - the object on which to search the property.key - the string name of the property to test.public ObjectType typeOf(Object object)
object - the object to get type.public ObjectType typeOf(Object object, String key)
object - the object on which to search the property.key - the string name of the property to test.public <T> CallbackProxy<T> newCallbackProxy()
this environment of java script as first argument of callback method.T - type of callback wrapped by proxypublic boolean isCanvasPattern(Object object)
true if the object is a CanvasPatternItem.object - the object instance on which to checktrue if the object is a CanvasPatternItempublic boolean isCanvasGradient(Object object)
true if the object is a CanvasGradientItem.object - the object instance on which to checktrue if the object is a CanvasGradientItempublic boolean isCanvas(NativeObjectContainer object, Key key)
true if the object is a Canvas.object - the object instance on which to checkkey - the string name of the property to test.true if the object is a Canvaspublic boolean isImage(NativeObjectContainer object, Key key)
true if the object is a Img.object - the object instance on which to checkkey - the string name of the property to test.true if the object is a Imgpublic int getIntegerProperty(Key key, NativeObject nativeObject)
key - the key to search inside the objectnativeObject - java script objectUndefined.INTEGER if not existpublic boolean getBooleanProperty(Key key, NativeObject nativeObject)
key - the key to search inside the objectnativeObject - java script objectUndefined.BOOLEAN if not existpublic String getStringProperty(Key key, NativeObject nativeObject)
key - the key to search inside the objectnativeObject - java script objectUndefined.STRING if not exist