Todo #330

Improving API for scripts to listen for events.

Added by derek clayton 646 days ago. Updated 441 days ago.

Status :New Start :04/28/2010
Priority :Normal Due date :
Assigned to :derek clayton % Done :

0%

Category :Modules
Target version :Future

Description

Since scripts are not Java classes they can't use the reflection based event handling mechanism that comes with Java. Instead they have to register for events through a proxy. Currently that proxy is called ScriptWrapper. The name is somewhat ambiguous and as well the additional argument for scripts only may cause some additional confusion for those following the Java examples.

Some solutions (or combinations):

1) Need better docs to explain the two arguments that are provided in the init method.
2) Have scripts use the regular method for listening for events and have the EventProducer classes determine if the Class is actually a Java class that is representing the script file. Then register for the event as if they had called the wrapper.
3) Change the name ScriptWrapper to be more descriptive.
4) Inspect the script file for known methods (eg. onObserverAdded(RoomEvent evt)) and when found have the script auto-register for the event so that script developers don't have to worry about registration at all. Possible for room (to which the room module script is associated) and server events but not for clients.

History

11/19/2010 08:56 PM - derek clayton

  • Target version changed from Pending Review to Future

Also available in: Atom