HTML5 (Javascript) Client Reference
Class gameRequests
Language: Javascript (HTML5)
The GameRequest service. This class has methods for sending game requests to other users, and for handling the requests received by the current user. All game request types have to be defined in the admin panel first.
Example
Refresh local requests
Example
Send a game request to another player
Example
Delete all waiting requests
Properties | ||||
---|---|---|---|---|
|
||||
Methods | ||||
|
||||
|
||||
|
gameRequests.waitingRequests
|
The list of waiting requests for the current user. You must call refresh() first to initialize this list.
gameRequests.delete
|
Delete the given requests. Will also update the waitingRequests property after deletion is complete.
Arguments
requests:gameRequest[] | |
The list of requests to delete. | |
successCallback:function() | |
Callback function that will be called when the delete has been completed. | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs. |
gameRequests.refresh
|
Refresh the list of received requests.
Arguments
successCallback:function() | |
Callback function that will be called when the refresh is complete | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs |
gameRequests.send
|
Send a GameRequest to the specified recipients.
Arguments
requestType:number | |
The request type of the request to send. | |
requestData:object | |
Data that will be available to the recipient of the request with information about the request. Useful for passing any kind of data to the recipient. | |
requestRecipients:string[] | |
The recipients to send this request to. | |
successCallback:function() | |
Callback function that will be called when the request has been sent. | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs. |