NSessionStorageService allows you to cache data on the client. The data stored in this service gets cleared when the page session ends. A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated.

Methods:

Variables:
  • sessionStorageCache: Stores the session storage data in memory.

Syntax:

JavaScript
sessionStorageCache -> {any}

getSessionStorage()

This method returns the data stored in session storage cache. 

Return type: <any>

Syntax:

JavaScript
getSessionStorage() -> {any}

Returns:

Returns the data stored in the sessionStoragecache variable.


setValue(key: any, value: any) 

This method sets the value of key.

PropertyDescription
keyThe key to be associated with the value.
valueThe value associated with the key

Return type: void

Syntax:

JavaScript
setValue(key: any, value: any) -> {}


getValue(key: any)  

This method returns the value of the key from the sessionStorage cache.

PropertyDescription
keyThe key to be associated with the value.

Return type: any

Syntax:

JavaScript
getValue(key: any) -> {any}

Returns:

Returns the value associated with the key.


remove(key:any)

This method removes the key value from the session storage.

Return type: void

Syntax:

JavaScript
remove(key: any) -> {}


clearSessionStorage() 

This method clears the data stored in sessionStorage.

Return type: void

Syntax:

JavaScript
clearSessionStorage() -> {}