Class Index | File Index

Classes


Class com.jiffeegames.Cookies

A Cookies object encapsulates all the cookies in a browser. In JIFFEE we use a cookie value to store the encoded state of the game, and we use the game fingerprint as part of the cookie-name.
Defined in: jiffee-cookies.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Create a Cookies object.
Method Summary
Method Attributes Method Name and Description
 
Test whether cookies are enabled.
 
Clear all cookies in this domain.
 
get(cName)
Retrieve the value of a named cookie from the browser.
 
init(locate, language)
 
Get the characters that can be used in cookie values.
 
remove(cName)
Remove a browser cookie.
 
set(cName, value, daysToLive)
Set the value of a browser cookie.
Class Detail
com.jiffeegames.Cookies()
Create a Cookies object. The normal call is
var cookies = new com.jiffeegames.Cookies();
You normally only need a single Cookies object.
Requires:
com.jiffeegames.Checks
Method Detail
{Boolean} areEnabled()
Test whether cookies are enabled. Note that if this returns false, then get/set/remove() will be no-ops.
Returns:
true if cookies are working, else false.

{void} clearAll_()
Clear all cookies in this domain. This function is intended only for testing, where it is needed as a work-around for the IE bug that limits a domain to a single cookie of maximum 4 KB size. If you call if from normal code, you can wipe out the state of unrelated games.

{String} get(cName)
Retrieve the value of a named cookie from the browser.
Parameters:
{String} cName
The name of the cookie whose value should be retrieved.
Returns:
The value of the cookie, or undefined if no such cookie exists.

init(locate, language)
Parameters:
locate
language

{String} legalChars()
Get the characters that can be used in cookie values. These are all the ASCII printable characters, with the following exceptions: This lets us utilize aproximately 6.5 bits out of every byte. These are deliberately not in ASCII order to provide added obfuscation.
Returns:
A list of all the legal cookie characters.

{void} remove(cName)
Remove a browser cookie.
Parameters:
{String} cName
The name of the cookie to be removed.

{void} set(cName, value, daysToLive)
Set the value of a browser cookie.
Parameters:
{String} cName
The name of the cookie.
{String} value
The value of the cookie. This must already be legally encoded, using only allowed characters.
{Number} daysToLive
The lifetime of the cookie.
Throws:
Error if the value is too long.

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