Constructor
new CypherPokerContract(gameRef)
Creates a new proxy contract instance.
Parameters:
Name |
Type |
Description |
gameRef |
CypherPokerGame
|
The active game instance with which
this contract interface is associated. |
- Source:
Extends
Members
active
Properties:
Name |
Type |
Default |
Description |
active |
Boolean
|
false
|
Indicates whether or not the contract is currently
active (recording or resolving a game). |
- Source:
contractID
Properties:
Name |
Type |
Default |
Description |
contractID |
String
|
null
|
The ID of the contract instance, usually
as returned by the remote contract host. If this is null , this
instance should not be considered valid. |
- Source:
cypherpoker
Properties:
- Source:
deferredActions
Properties:
Name |
Type |
Description |
deferredActions |
Array
|
Indexed list of objects containing
game state snapshot , invoke , promise ,
parent contract , and boolean complete properties. |
- Source:
deferredActivePromises
Properties:
Name |
Type |
Description |
deferredActivePromises |
Array
|
Indexed list of Promise instances currently
in the CypherPokerContract#deferredActions array which have the property:
complete == false |
- Source:
deferredPromises
Properties:
- Source:
game
Properties:
Name |
Type |
Description |
game |
CypherPokerGame
|
Reference to the associated game for
which to act as contract handler. |
- Source:
history
Properties:
Name |
Type |
Default |
Description |
history |
Array
|
null
|
Indexed array of external contract snapshots
with index 0 being the most recent. |
- Source:
players
Properties:
Name |
Type |
Description |
players |
Array
|
Indexed list of {CypherPokerPlayer} instances copied
from the associated CypherPokerContract#game instance. |
- Source:
ready
Properties:
Name |
Type |
Default |
Description |
ready |
Boolean
|
false
|
Indicates whether or not the contract is
ready (has been successfully remotely created). |
- Source:
table
Properties:
- Source:
Methods
addEventListener(type, listener, contextopt)
Registers a new event listener with the extending class instance.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
type |
String
|
|
|
The event type to register. |
listener |
function
|
|
|
The listening function to invoke on the event. |
context |
Object
|
<optional>
|
null
|
Unlike the traditional addEventListener parameter, this is
the context or scope in which to invoke the listening function (since we can't use capture phases).
If null, the listener is invoked in the context of the EventDispatcher or extending instance. |
- Inherited From:
- Source:
gameSnapshot()
Creates a snapshot (copy) of the associated
CypherPokerContract#game instance's
current data in the format of a contract data object for use as a condition in subsequent
contract actions.
- Source:
- Source:
Returns:
The
CypherPokerPlayer instance that
is flagged as a dealer.
null
is returned if no dealer is flagged.
-
Type
-
CypherPokerPlayer
getListeners(type) → {Array}
Returns all registered listeners for a specific event type.
Parameters:
Name |
Type |
Description |
type |
String
|
The event type to return registered listeners for. |
- Inherited From:
- Source:
Returns:
A list of registered event listener objects for the specific event.
Each object contains a listener
function reference and an
execution context
reference.
-
Type
-
Array
Parameters:
Name |
Type |
Description |
privateID |
String
|
The private ID of the player. |
- Source:
Returns:
The
CypherPokerPlayer for the private ID
associated with this game.
null
is returned if no matching
player private ID can be found.
-
Type
-
CypherPokerPlayer
getPlayers(includeKeychainsopt, includePasswordsopt) → {Object}
Parameters:
- Source:
Returns:
The condensed players array associated with this game instance.
-
Type
-
Object
removeEventListener(type, listener, contextopt)
Removes an event listener from the extending instance.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
type |
String
|
|
|
The event type to remove the function from. |
listener |
function
|
|
|
The listening function to remove. |
context |
Object
|
<optional>
|
null
|
The context or scope in which the listener exists. |
- Inherited From:
- Source:
Events
timeout
The contract appears to have timed out due to player inactivity. This is a local event
and does not necessarily reflect the state of the actual contract.
Type:
Properties:
Name |
Type |
Description |
contract |
CypherPokerContract
|
The instance dispatching the event. |
penalized |
Array
|
Array of objects containing private ID(s) and
the amount tahat the associated player(s) were penalized. Typically
only one player will time out (penalized[0]), but under certain
conditions more than one player may time out. |
- Source:
timeoutinvalid
The contract timeout is no longer valid (e.g. the game has ended).
Type:
Properties:
- Source:
timeoutstart
The contract timeout timer has been started or restarted.
Type:
Properties:
Name |
Type |
Description |
contract |
CypherPokerContract
|
The instance dispatching the event. |
seconds |
Number
|
The number of seconds that must elapse without
player activity before the contract times out. |
cSeconds |
Number
|
The number of courtesy seconds that will
be allowed to elapse before the contract's "timeout" function is
invoked. Note that the timeout may occur at any time after the contract
has timed out (hence "courtesy" seconds). |
- Source: