public class JSContext
extends java.lang.Object
Browser.executeJavaScriptAndReturnValue(long, String)
method for required frame.
When frame is reloaded or another web page is loaded, all existing contexts will be destroyed and new contexts will be created. To check whether context is destroyed call the
isDisposed()
method or use
DisposeListener
.
Modifier and Type | Method and Description |
---|---|
void |
addDisposeListener(DisposeListener<JSContext> listener)
Adds the specified dispose listener to receive dispose events from this context instance.
添加指定的Dispose侦听器以从此上下文实例接收Dispose事件。 |
JSObject |
createObject()
Create a new empty JavaScript object instance that is available in scope of the current execution context.
创建一个新的空JavaScript对象实例,该实例在当前执行上下文的范围内可用。 |
boolean |
equals(java.lang.Object o) |
java.util.List<DisposeListener<JSContext>> |
getDisposeListeners()
Returns a list of all the dispose listeners registered on this context.
返回在此上下文中注册的所有处置侦听器的列表。 |
long |
getFrameId()
Returns unique identifier of a frame which is associated this this JavaScript execution context.
返回与此JavaScript执行上下文相关联的框架的唯一标识符。 |
long |
getWorldId()
Returns JavaScript world identifier associated with the current context.
返回与当前上下文关联的JavaScript世界标识符。 |
int |
hashCode() |
boolean |
isDisposed()
Indicates whether context is disposed or not.
指示是否处置上下文。 |
void |
removeDisposeListener(DisposeListener<JSContext> listener)
Removes the specified dispose listener so that it no longer receives context dispose events from this instance.
移除指定的Dispose侦听器,以使其不再从该实例接收上下文Dispose事件。 |
public long getFrameId()
isDisposed()
method.
public long getWorldId()
public JSObject createObject()
java.lang.IllegalStateException
- when context is not valid anymore and disposed.
public boolean isDisposed()
true
when context is disposed, otherwise -
false
.
处理上下文时,否则-。
public void addDisposeListener(DisposeListener<JSContext> listener)
listener
is
null
, no exception is thrown and no action is performed.
listener
- the context dispose listener.
-上下文配置侦听器。
public void removeDisposeListener(DisposeListener<JSContext> listener)
listener
- the context dispose listener to remove.
-上下文将侦听器删除。
public java.util.List<DisposeListener<JSContext>> getDisposeListeners()
DisposeListener
s or an empty list if no dispose listeners are currently registered.
所有此上下文的;如果当前未注册任何处置侦听器,则返回一个空列表。
public boolean equals(java.lang.Object o)
equals
in class
java.lang.Object
public int hashCode()
hashCode
in class
java.lang.Object