pureweb.client. SessionStorage

The SessionStorage class provides an automatically synchronized and subscribable key/value store, private between this client and the service application.

This class can be used to set/get values into the session store, and you can register a selector to listen for changes to particular keys in the store.

Method Summary

addValueChangedHandler
Registers a changed handler for a value in session storage.
containsKey
Determines if a given key exists in session storage.
getKeys
Returns an array of all the keys in session storage.
getValue
Gets the value for a particular key from session storage.
removeAllValueChangedHandlers
Unregisters all value changed handlers associated with the specified key in session storage.
removeValue
Removes a key/value pair from session storage.
removeValueChangedHandler
Unregisters the specified value changed handler for session storage.
setValue
Sets the value for a particular key in session storage.

Constructor

new SessionStorage(webclient)

Initializes a new instance of SessionStorage.
Parameters:
Name Type Description
webclient pureweb.client.WebClient The webclient to which this instance of session storage is attached.

Extends

  • pureweb.events.EventTarget

Members

<static> EventType → string

Types of events SessionStorage fires.
Properties:
Name Type Default Description
KEY_ADDED string Event dispatched when a new key is added.

Method Detail

addValueChangedHandler(key, handler, context)

Registers a changed handler for a value in session storage. When the specified value changes, the associated handling function will be called.
Parameters:
Name Type Argument Description
key string The key whose corresponding value you want to watch for changes.
handler Object The handling function to execute when the value changes.
context Object <optional>
The context in which the handler will be executed (i.e. 'this').
Throws:

containsKey(key) → {boolean}

Determines if a given key exists in session storage.
Parameters:
Name Type Description
key string The key that will be tested for its presence.
Throws:
If key is null or undefined:
pureweb.NullArgumentException

getKeys() → {Array.<string>}

Returns an array of all the keys in session storage.

getValue(key) → {string}

Gets the value for a particular key from session storage.
Parameters:
Name Type Description
key string The key for which the corresponding value will be returned.
Throws:
If key is null or undefined:
pureweb.NullArgumentException

removeAllValueChangedHandlers(key)

Unregisters all value changed handlers associated with the specified key in session storage.
Parameters:
Name Type Description
key string The key.
Throws:
If key is null or undefined:
pureweb.NullArgumentException

removeValue(key, suppressHandlers)

Removes a key/value pair from session storage.
Parameters:
Name Type Argument Description
key string The key which will be removed, along with the corresponding value.
suppressHandlers boolean <optional>
Set to yes to suppress the change handlers for this change, or set to no otherwise.
Throws:

removeValueChangedHandler(key, handler)

Unregisters the specified value changed handler for session storage.
Parameters:
Name Type Description
key string The key to the value in session storage.
handler Object The handler that you are unregistering.
Throws:
If either key or handler is null or undefined:
pureweb.NullArgumentException

setValue(key, value, suppressHandlers)

Sets the value for a particular key in session storage. If the key doesn't exist, it will be added.
Parameters:
Name Type Argument Description
key string The key under which to store the value.
value string The value to store.
suppressHandlers boolean <optional>
Set to yes to suppress the change handlers for this change, or set to no otherwise.
Throws: