AJAX - The Complete Reference

(avery) #1

536 Part III: Advanced Topics


Method

Description

Example

add(

key,value,

persistenceObject [, store]

)

Stores the value specified as a string at the key specified in the appropriate storage system bound to the persistence object. In the case of Internet Explorer, the

store

parameters may also be passed in otherwise a default value is supplied.

AjaxTCR.storage.add("fortknox","lots of gold",persistObj)

get(

key,

persistanceObject[,store]

)

Retrieves data at the passed key from the storage system related to the persistenceObject

.

var treasure = AjaxTCR.storage.get("fortknox", persistObj);alert(treasure); /* shows "lots of gold" */

getAll(

persistenceObject

[,store]

)

Retrieves all data from the storage system referenced by the persistenceObject

.

var allTreasure = AjaxTCR.storage.getAll(persistObj);

init()

Initializes the data store for holding persisted data. Returns a handle to the persistence object. Persistence system tries to accommodate Firefox and Internet Explorer persistence forms and degrades to cookies if necessary.

var persistObj = AjaxTCR.storage.init();

clear(

persistenceObject

[,store]

)

Clears all the items out of the storage system related to the persistenceObject

.

AjaxTCR.storage.clear(persistObj)

remove(

key,

persistanceObject[,store]

)

Removes the data from the storage system related to the passed

key

.

AjaxTCR.storage.remove("fortknox", persistObj);/* no more gold */

TABLE

10-4

Methods of AjaxTCR.storage

http://www.ebooks.org.in

Free download pdf