This namespace contains function helpers that allow to save and retrieve cookies and browser data.
- Source:
- mapspace/bu.jsdoc
Methods
-
<static> deleteCookie(name, path, domain)
-
Deletes a cookie. (Sets expiration date to start of epoch)
Parameters:
Name Type Description name
string String object containing the cookie name
path
string String object containing the path of the cookie to delete. This MUST be the same as the path used to create the cookie, or null/omitted if no path was specified when creating the cookie.
domain
string String object containing the domain of the cookie to delete. This MUST be the same as the domain used to create the cookie, or null/omitted if no domain was specified when creating the cookie.
- Source:
- mapspace/storage.js
-
<static> deleteLocalItem(key)
-
Deletes a local item.
Parameters:
Name Type Description key
string Key for the value to search.
- Source:
- mapspace/storage.js
-
<static> deleteLocalItems()
-
Delete all local items.
- Source:
- mapspace/storage.js
-
<static> deleteSession(deleteExtraData)
-
Deletes all current session data.
Parameters:
Name Type Description deleteExtraData
boolean If delete extra data or not.
- Source:
- mapspace/storage.js
-
<static> deleteSessionItem(key)
-
Deletes a session item.
Parameters:
Name Type Description key
string Key for the value to search.
- Source:
- mapspace/storage.js
-
<static> getCookie(name)
-
Returns the value of the cookie specified by "name".
Parameters:
Name Type Description name
string String object containing the cookie name.
- Source:
- mapspace/storage.js
Returns:
String object containing the cookie value, or null if the cookie does not exist.
- Type
- string
-
<static> getLocalItem(key)
-
Returns a local item or null if it has expired.
Parameters:
Name Type Description key
string Key to search the item.
- Source:
- mapspace/storage.js
Returns:
The value stored or null.
- Type
- string
-
<static> getSessionItem(key)
-
Returns a session item or null if it has expired.
Parameters:
Name Type Description key
string Key to search the item.
- Source:
- mapspace/storage.js
Returns:
The value stored or null.
- Type
- string
-
<static> setCookie(name, value [, expires] [, path] [, domain] [, secure])
-
Creates or updates a cookie.
The first two parameters are required. The others, if supplied, must be passed in the order listed above. To omit an unused optional field, use null as a place holder. For example, to call setCookie using name, value and path, you would code:
Mapspace.storage.setCookie ("myCookieName", "myCookieValue", null, "/");
Note that trailing omitted parameters do not require a placeholder.
To set a secure cookie for path "/myPath", that expires after the current session, you might code:
Mapspace.storage.setCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
Parameters:
Name Type Argument Description name
string String object containing the cookie name.
value
string String object containing the cookie value. May contain any valid string characters.
expires
Date <optional>
Date object containing the expiration data of the cookie. If omitted or null, expires the cookie at the end of the current session.
path
string <optional>
String object indicating the path for which the cookie is valid. If omitted or null, uses the path of the calling document.
domain
string <optional>
String object indicating the domain for which the cookie is valid. If omitted or null, uses the domain of the calling document.
secure
boolean <optional>
Boolean (true/false) value indicating whether cookie transmission requires a secure channel (HTTPS).
- Source:
- mapspace/storage.js
-
<static> setLocalItem(key, value [, max_age])
-
Sets a local item.
Parameters:
Name Type Argument Description key
string Key for the value.
value
string Value to store.
max_age
number <optional>
Optional time in seconds to expire value. If no value then value never expires.
- Source:
- mapspace/storage.js
-
<static> setSessionItem(key, value [, max_age])
-
Sets a session item.
Parameters:
Name Type Argument Description key
string Key for the value.
value
string Value to store.
max_age
number <optional>
Optional time in seconds to expire value. If no value then value never expires.
- Source:
- mapspace/storage.js