AJAX - The Complete Reference

(avery) #1

628 Part IV: Appendixes


Method

Description

Example

add(

key,value,

persistenceObject [,store]

)

Stores the value specified as a string at the key specified in the appropriate data store. The

persistenceObject

is returned from the

init()

method. In the case of Internet Explorer a store parameter string may be passed as well to define what store the data is associated with.

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

get(

key,persistenceObject

[,store]

)

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

. In the


case of Internet Explorer you may also pass in a store value.

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 passed

persistenceObject.

In the case of IE it would fetch only the values from the passed store value or its default value of “AjaxTCRStore” if not passed.

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

init()

Initializes the data store for holding persisted data. Returns a handle to the persistence object.

var persistObj = AjaxTCR.storage.init();

clear(

persistenceObject

[, store]

)

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

persistenceObject

and store value.

AjaxTCR.storage.clear(persistObj);

remove(

key,persistance

Object[,store]

)

Removes the data from the storage system related to peristanceObject

related to

the passed key. In the case of Internet Explorer you may also pass a

store

value.

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

TABLE

C-10

Abstract Methods for Data Persistence

http://www.ebooks.org.in

Free download pdf