Namespace rap
Holds all public API of the RAP WebClient.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
rap.getObject(id)
Returns the client object associated with the given id.
|
<static> |
rap.getRemoteObject(object)
Returns an instance of RemoteObject for the given client object.
|
<static> |
rap.off(type, listener)
De-register the function as a listener of the given type.
|
<static> |
rap.on(type, listener)
Register the function as a listener of the given type.
|
<static> |
rap.registerTypeHandler(type, handler)
Registers a RAP protocol type handler for a specific type of client objects.
|
Event Attributes | Event Name and Description |
---|---|
Sent after a message has been processed.
|
|
Sent right before a message is send to the server.
|
Method Detail
<static>
{Object}
rap.getObject(id)
Returns the client object associated with the given id.
If there is no object registered for the given id, null is returned.
For RAP internal objects (e.g. RWT widgets) a wrapper is returned instead of the real object.
- Parameters:
- {string} id
- The protocol id for a client object.
- Returns:
- {Object} The client object associated with the id.
- See:
- Composite
<static>
{RemoteObject}
rap.getRemoteObject(object)
Returns an instance of RemoteObject for the given client object.
A client object is any object that was created by an type handler factory method.
Multiple calls for the same object will return the same RemoteObject
instance.
- Parameters:
- {Object} object
- The client object.
- Returns:
- {RemoteObject}
<static>
rap.off(type, listener)
De-register the function as a listener of the given type.
- Parameters:
- {string} type
- The type of the event
- {Function} listener
- The callback function
<static>
rap.on(type, listener)
Register the function as a listener of the given type. Registering unkown
types throws an Error.
- Parameters:
- {string} type
- The type of the event (e.g. "send").
- {Function} listener
- The callback function. It is executed in global context.
<static>
rap.registerTypeHandler(type, handler)
Registers a RAP protocol type handler for a specific type of client objects.
The handler is used by the protocol message processor to process operations that target
any client object of this type. Example:
rap.registerTypeHandler( "project.MyWidget", { factory : function( properties ) { return new MyWidget(); }, properties : [ "propA", "propB" ] } );
- Parameters:
- {string} type
- {Object} handler
- The handler object.
- {Function} handler.factory
- Called for create operations. Is given a properties object as the first argument, which may contain any number for properties/fields set by the server. Has to return a "client object" representing an instance of the type of this handler. Required for all type handler.
- {string} handler.destructor
- Name of the method that is called for destroy operations. If the string is given, the client object has to implement a method with the given name. Optional
- {string[]} handler.properties
- List of properties supported by this type.
The order in the list controls the order in which the properties are applied by the message
processor. The client object has to implement a setter for each supported property.
For example, if the property is "bounds",
setBounds
will be called on the client object. Properties given by the server that are not in this list will be ignored. (One exception is the factory, which gets an object with all properties set by the server at that time.) If the property changes on the client, RemoteObject#set can be used to synchronize the value with the server. Optional. - {string[]} handler.methods
- List of methods supported by this type. The order in the list is meaningless, "call" operations are processed in the order in which they are given by the server. The client object has to implement a method of the same name. One argument will be given, which is a properties object with any number of properties/fields. A "call" operation given by the server for a method that is not in this list will be ignored. Optional.
- {string[]} handler.events
- List of event types supported by this type. The server may instruct the client object with "listen" operations to start or stop sending notifications when events of he given event type occur. Notifications may and can only be sent for types that are given in this list and are listend to by the server. See also RemoteObject#notify. Optional.
Event Detail
render
Sent after a message has been processed.
send
Sent right before a message is send to the server.