Service Designer User's Guide
Direct link to topic in this publication:
A Storage node is used to store, retrieve, or manipulate data in the local or session storage of the browser. The data is stored in key-value pairs.
- Local storage is a type of web storage that allows websites and apps to store and access data right in the browser with no expiration date. This means the data stored in the browser will persist even after the browser window has been closed.
- Session storage is similar to localStorage; the only difference is while data stored in the local storage has no expiration time, whereas data stored in session storage gets cleared when the page session ends.
How to Use
- Open the Services editor window.
- Click the Add Service button to add a new service or open an existing service.
- In the Nodes palette, drag and drop a Switch node to the workspace.
- Drag and drop other nodes to create a flow.
To use local storage or session storage in your web applications, you can use these methods:
- setItem(): Add key and value to localStorage
- getItem(): Retrieve a value by the key from localStorage
- removeItem(): Remove an item by key from localStorage
- clear(): Clear all localStorage
This method allows you to store values in the local storage or session storage object.
It takes two parameters, a key , and a value. The key can be referenced later to fetch the value attached to it. You can set the item in both local storage and session storage at the same time.
You can only store string values in these storages.
The getItem() method allows you to access the data stored in the browser’s local storage object. It accepts only the key parameter and returns the value associated with the specified key (as a string). This operation can be performed on only one storage at a time. Choose Local storage or session storage in which the required data is stored.
The removeItem() method when passed a key name, will remove that key from the storage if it exists. If there is no item associated with the given key, this method will do nothing. You can remove the item in both local storage and session storage at the same time.
This method, when invoked clears the entire storage of all records for that domain. You can clear storage for both local storage and session storage at the same time.
Value: This field appears only when you want to set an item to the storage. The data that you want to store.
Result mapping: This property appears when you choose the get item operation. You can map the retrieved data to bh.local or bh.input properties.