Class Index | File Index

Classes


Class com.jiffeegames.Persistence

A Persistence object defines and implements the functions and commands used to resume, save, restore, or restart a game:


Defined in: jiffee-persistence.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Create a Persistence object.
Method Summary
Method Attributes Method Name and Description
<private>  
Command handler for beginning of game.
<private>  
Command handler for the "restart" command.
<private>  
Command handler for the "restore" command.
<private>  
doSaveCmd_(event)
Command handler for the "save" command.
<private>  
Handler for saving complete state after each move, so that a game can be resumed later.
<static>  
com.jiffeegames.Persistence.es()
Set the language to Spanish.
 
init(locate, language)
<private>  
isLegalName_(cName)
Check to see if a potential cookie-name is legal.
<private>  
Restore state.
Class Detail
com.jiffeegames.Persistence()
Create a Persistence object. The typical call is:
var persistence = new com.jiffeegames.Persistence();
Method Detail
<private> {void} doInitialState_(event)
Command handler for beginning of game. This saves the initial state (to enable restarts), and automatically resumes any previous game (by restoring from the default cookie).
Parameters:
event

<private> {void} doRestartCmd_(event)
Command handler for the "restart" command. This resets the state back to the initial state, i.e. returns the player to the beginning of the game.
Parameters:
{Object} event
The event that triggered the call.

<private> {void} doRestoreCmd_(task)
Command handler for the "restore" command. Restores the complete state of the game from a cookie with the given name. The fingerprint is appended to the name internally to avoid version clashes.
Parameters:
{Object} task
The event that triggered the call.

<private> {void} doSaveCmd_(event)
Command handler for the "save" command. Saves the complete state of the game in a cookie with the given name. The fingerprint is appended to the name internally to avoid version clashes.
Parameters:
{Object} event
The event that triggered the call.

<private> {void} doSaveEveryTurn_(event)
Handler for saving complete state after each move, so that a game can be resumed later. The state is saved in the default cookie.
Parameters:
event

<static> {void} com.jiffeegames.Persistence.es()
Set the language to Spanish.

init(locate, language)
Parameters:
locate
language

<private> isLegalName_(cName)
Check to see if a potential cookie-name is legal.
Parameters:
{String} cName
The name to check.
Returns:
true if the name is legal

<private> {void} restoreState_(state)
Restore state. Does the work of restoring a state to all the slots and getting the game ready to roll again.
Parameters:
{String} state
the state encoded as a string

Documentation generated by JsDoc Toolkit 2.3.2 on Sun Jul 25 2010 13:49:31 GMT-0700 (PDT)