public abstract class XWalkExtension
extends java.lang.Object
| Constructor and Description |
|---|
XWalkExtension(java.lang.String name,
java.lang.String jsApi)
Constructor with name and javascript API.
|
XWalkExtension(java.lang.String name,
java.lang.String jsApi,
java.lang.String[] entryPoints)
Constructor with name, javascript API and entry points.
|
| Modifier and Type | Method and Description |
|---|---|
void |
broadcastMessage(java.lang.String message)
Broadcast message to all extension instances.
|
protected java.lang.Object |
getBridge() |
void |
onBinaryMessage(int instanceID,
byte[] message)
Notify the extension that the async binary message is received.
|
void |
onInstanceCreated(int instanceID)
Notify the extension that an instance is created.
|
void |
onInstanceDestroyed(int instanceID)
Notify the extension that an instance is destroyed.
|
abstract void |
onMessage(int instanceID,
java.lang.String message)
Notify the extension that the async message is received.
|
abstract java.lang.String |
onSyncMessage(int instanceID,
java.lang.String message)
Notify the extension that the sync message is received.
|
void |
postBinaryMessage(int instanceID,
byte[] message)
Send binary message to an instance.
|
void |
postMessage(int instanceID,
java.lang.String message)
Send message to an instance.
|
public XWalkExtension(java.lang.String name,
java.lang.String jsApi)
name - the exposed namespace.jsApi - the string of javascript API.public XWalkExtension(java.lang.String name,
java.lang.String jsApi,
java.lang.String[] entryPoints)
name - the exposed namespace.jsApi - the string of javascript API.entryPoints - Entry points are used when the extension needs to
have objects outside the namespace that is
implicitly created using its name.protected java.lang.Object getBridge()
public void postMessage(int instanceID,
java.lang.String message)
instanceID - the id of instance.message - the message.public void postBinaryMessage(int instanceID,
byte[] message)
instanceID - the id of instance.message - the binary message.public void broadcastMessage(java.lang.String message)
message - the message.public void onInstanceCreated(int instanceID)
instanceID - the id of instance.public void onInstanceDestroyed(int instanceID)
instanceID - the id of instance.public void onBinaryMessage(int instanceID,
byte[] message)
instanceID - the id of instance.message - the received binar message.public abstract void onMessage(int instanceID,
java.lang.String message)
instanceID - the id of instance.message - the received message.public abstract java.lang.String onSyncMessage(int instanceID,
java.lang.String message)
instanceID - the id of instance.message - the received message.