Storage

This section describes the Cookie and Depot objects and methods. Each section includes a brief description, repeating some of the information from Chapter 6, followed by an enumeration of each object’s methods with their arguments and return values. Both storage objects are accessed through a direct API, so the format for this entry will be structured as an API entry.

If you’d like more detailed information on the HTML 5 Database object, refer to the specification at http://dev.w3.org/html5/webstorage/#databases.

Mojo.Model.Cookie()

Mojo cookies are technically related to browser cookies, but with an object interface to simplify use by webOS applications. Mojo cookies typically store small amounts of data that will be used to preserve application state and related information, such as preference settings.

Calling the constructor will open the named cookie if it already exists, or if it doesn’t exist, will create it.

Constructor

new Mojo.Model.Cookie(cookieName, optionalDocument)

Arguments

Type

Description

cookieName

String

Name for the cookie; has an application scope so uniqueness across applications is not a requirement

optionalDocument

Object

Document element to store cookie; defaults to current document

Methods

get()

Returns the object stored in this cookie, or undefined if the cookie doesn’t exist

put(objectToStore, expirationDate)

Updates the value of this cookie with the passed object with an optional date object to set an expiration date; if no expiration date is set, the cookie ...

Get Palm webOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.