|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ScriptWrapper
A ScriptWrapper acts as a proxy for scripts for event handling. All scripts are passed a ScriptWrapper in the init method. Scripts can then use the wrapper to register for events on the server. JavaScript Example: function init(ctx, wrap) { context = ctx; wrapper = wrap; wrapper.addRoomEventListener(RoomEvent.ADD_CLIENT, "onRoomAddClient"); wrapper.addRoomEventListener(RoomEvent.REMOVE_CLIENT, "onRoomRemoveClient"); } Scripts can then implement the event callback methods normally. JavaScript Example: function onRoomAddClient(evt) { println("Client [" + evt.getClient().getClientID() + "] joined the Room"); }
| Method Summary | |
|---|---|
void |
addClientEventListener(Client client,
java.lang.String event,
java.lang.String method)
Add a client event listener to the given room. |
void |
addRoomEventListener(Room room,
java.lang.String event,
java.lang.String method)
Add a room event listener to the given room. |
void |
addRoomEventListener(java.lang.String event,
java.lang.String method)
Add a room event listener to the room to which the room module script is attached. |
void |
addServerEventListener(java.lang.String event,
java.lang.String method)
Add an event listener to the server. |
void |
removeClientEventListener(Client client,
java.lang.String event,
java.lang.String method)
Remove an event listener from the given client. |
void |
removeRoomEventListener(Room room,
java.lang.String event,
java.lang.String method)
Remove an event listener from the given room. |
void |
removeRoomEventListener(java.lang.String event,
java.lang.String method)
Remove an event listener from the room to which the room module script is attached. |
void |
removeServerEventListener(java.lang.String event,
java.lang.String method)
Remove an event listener from the server. |
| Method Detail |
|---|
void addRoomEventListener(java.lang.String event,
java.lang.String method)
event - - the event the script wants to listen tomethod - - the method that will be invoked on the script when the event occurs
void removeRoomEventListener(java.lang.String event,
java.lang.String method)
event - - the event the script was listening tomethod - - the method that was invoked on the script when the event occurs
void addRoomEventListener(Room room,
java.lang.String event,
java.lang.String method)
room - - the room to listen to for the event occurringevent - - the event the script wants to listen tomethod - - the method that will be invoked on the script when the event occurs
void removeRoomEventListener(Room room,
java.lang.String event,
java.lang.String method)
room - - the room that was being listened toevent - - the event the script was listening tomethod - - the method that was invoked on the script when the event occurs
void addClientEventListener(Client client,
java.lang.String event,
java.lang.String method)
client - - the room to listen to for the event occurringevent - - the event the script wants to listen tomethod - - the method that will be invoked on the script when the event occurs
void removeClientEventListener(Client client,
java.lang.String event,
java.lang.String method)
client - - the client that was being listened toevent - - the event the script was listening tomethod - - the method that was invoked on the script when the event occurs
void addServerEventListener(java.lang.String event,
java.lang.String method)
event - - the event the script wants to listen tomethod - - the method that will be invoked on the script when the event occurs
void removeServerEventListener(java.lang.String event,
java.lang.String method)
event - - the event the script was listening tomethod - - the method that was invoked on the script when the event occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||