Browser Storage Component
Overview
The Browser Storage component lets you add, edit, delete, and retrieve data on your browser. The component stores data using the IndexedDB API (application programming interface) call. IndexedDB is a large storage system for storing data in your browser. As the name suggests, this API call lets you store large amounts of structured, indexed information locally. The API call also lets you filter and search this indexed information.
You'll find the Browser Storage component in the Data & Event Processing group at the left of the Module Editor.
What You'll Learn
In this article, you'll learn how to:
- Use the Browser Storage component's configuration window.
- Add and configure a Browser Storage component.
- Understand the structure of a Browser Storage component's data.
- Apply best practices.
- Edit a Browser Storage component.
- Move a Browser Storage component.
- Copy a Browser Storage component.
- Remove a Browser Storage component.
About the Configuration Window
Jump to:
General
Setting | Description |
---|---|
Active |
The component is active and visible in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. After configuring a module, click Preview in the Module Editor to interact with the module in Express View. While active, other components and processes can reference your component. Setting the toggle to By default, the Active toggle is set to |
Property ID |
A Property ID is the unique field ID used by Unqork to track and link components in your module. The Property ID is how the software identifies your component. Using Property IDs lets you link components, creating logic-based configurations and API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. calls. Property IDs must use camel case A naming convention for computer programming. Use camelCase for Property IDs, for example: newUser, lastName, & rdoButton. (stylized as camelCase) without spaces or punctuation. |
Field Tags |
Assign components one-word labels to help organize, identify, and group the components in your application. Consider an example from the API Specification Snippet: Field Tags are applied to Hidden components in the panelRequest and panelResponse Panels. The Field Tags identify the data type of parameters included in the API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. request and response. The API Docs Dashboard tool populates with information about each parameter’s data type, identified by the Field Tag. Field Tags act as a type of Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. group and let you group components for configuration purposes. Field Tags let you target two or more components using a simple logic component. For example, add the Field Tag tagForDecision to multiple components in your module. Open the Inputs table of a Decisions component and reference the tagForDecision Field Tag as the input of the Decisions component. The output of the Decisions component then affects all components with the tagForDecision Field Tag. Save your Field Tags by pressing Enter (Return) or adding a comma after each entry. |
Settings Tab |
Select this tab to display the component's Display, Data, Actions, and Validation settings panels, as applicable. |
Permissions Tab |
Select this tab to see the RBAC RBAC (Role-Based Access Control) is a method to control system access for authorized users. The role in RBAC refers to the levels of access employees have to a network. (role-based access control) settings of the component. |
Notes Tab |
Select this tab to display the component's Notes area. You can use notes to keep your teammates informed. The Notes editor offers a semi-WYSIWYG (What You See is What You Get) content editor. Built to look like a word processor, this editor lets you create, edit, and format your notes. Notes save when saving the component. |
Cancel Button |
Click this button to undo any unsaved configuration changes and return to the canvas. |
Save Button |
Click this button to save all settings as configured and return to the canvas. |
Display Panel
Setting | Description |
---|---|
Canvas Label Text |
Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. User-friendly labels make your module more accessible. Keep labels short and descriptive (a word or two) using title case. For longer entries, use sentence case. |
Data Panel
Setting | Description |
---|---|
Operation Type |
The Browser Storage component has the following options:
|
Namespace |
A Namespace is required. This is a unique label applied to the information you store in the IndexedDB object store. The Read, Write, and Delete operations happen only to the data entered in the Namespace. TIP It's best practice to use your module's unique module ID in the Browser Storage component's Namespace. For example, inspections5ffddf6ae336b802494437c8, where 5ffddf6ae336b802494437c8 is the module ID of the front-end source module. The Namespace is where the source module stored its data on the browser. |
Filters Table
The Browser Storage component's Filters table helps you find information stored in the browser's IndexedDB object store.
Setting | Description |
---|---|
Property ID |
This is the Property ID of the stored information. Mapping to this Property ID performs the Write, Read, and Delete operations to that data. TIP The Property ID entered must match the Property ID used in the input component. Remember, use camel case (stylized as camelCase) without spaces or punctuation. |
Set Filter To |
This drop-down lets you select how you want to compare the Filter’s Property ID to its mapping. Your options are: =, <, or >. |
Mapping |
Mapping describes where in the stored data you're filtering. This mapping information tells the component what data to push to or call when triggered. |
Required |
If selected, the end-user must enter a value in the field of this input component before the logic component fires. |
Exclude |
If selected, the filter operation doesn't run when you trigger the Browser Storage component. |
Optional |
If selected, or if the field has no value, the operation doesn't run when you trigger the Browser Storage component. By default, all inputs in the request body progress, even if the field is empty (null). |
Replace |
This toggle is only available when the Operation Type is set to Write. If this toggle is set to ON, the entire data object is replaced when you make changes. If this toggle is set to OFF, the new data merges into the data object. By default, the Replace toggle is set to OFF. |
Inputs Table
Input settings are only available for the Write operation.
Setting | Description |
---|---|
Property ID |
This Property ID refers to your triggering component. Use this field to enter values that you send to the browser’s IndexedDB object store. |
Mapping |
API documentation includes mapping information. This mapping information tells the Browser Storage component which information to push or call from the browser's IndexedDB object store. TIP You can find the Unqork API documentation here: https://developers.unqork.io/. |
Required |
If selected, the end-user must enter a value in the field of this input component before the logic component fires. |
Exclude |
If selected, the component doesn't pass the field as part of the request body of the API call. The component still watches for changes to the value. |
Optional |
If selected, and the field has no value, the operation doesn't run when triggered. By default, all inputs in the request body work, even if the field is empty (null). |
Outputs Table
Setting | Description |
---|---|
Property ID |
This Property ID is where you want the component to send the data retrieved from your browser. For your logic component to recognize an output, you must enter the destination component's Property IDs. TIP The Property ID you enter must match the Property ID used in the output component. Remember, use camel case (stylized as camelCase) without spaces or punctuation. |
Mapping |
Map Property IDs according to API specifications. Mapping tells your component what to retrieve from the browser. For instance, to retrieve the first stored submission, enter 0.data.storedExample. The [0] represents your first saved record, [1] is the second, and so on. |
Actions Panel
Setting | Description |
---|---|
Post Trigger |
Enter the Property ID of the component that you want to trigger after the Browser Storage component completes the API call. For example, triggering a component to display the data received from the Browser Storage component's API call. |
Error Trigger |
Enter the Property ID of a component that you want to trigger on failure of the API call. |
Set Bounce |
The number of milliseconds that pass before the module loads this component. This is useful if you have a large module and you load several components at the same time. NOTE 1,000 milliseconds = 1 second. |
Disable Execution |
If Disable Execution is set to By default, Disable Execution is set to |
Adding a Browser Storage Component
First, you'll configure a survey application for use offline. This survey has fields for surveyor name, date surveyed, and other various criteria. This front-end module lets you input values that a Browser Storage unit writes to the browser cache. To save you time, this module is prebuilt here: https://training.unqork.io/#/form/5ffddf6ae336b802494437c8/edit.
NOTE This module is also set up for offline use at the module and environment levels.
Next, you'll create a module to read the submissions stored in the browser.
Enabling Environment-Level Offline Access
To enable offline access at the Environment Level for your new module:
1. | At the top right of the Unqork Designer Platform, click the Settings drop-down. |
2. | Click Administration. |
3. | Under Environment, select Environment Administration. |
4. | At the bottom of the page, select Enable Offline. |
5. | Click Save Changes. |
Enabling Module-Level Offline Access
To enable offline access at the Module-Level for your new module:
1. | Open a new module in the Module Editor. |
2. | Hover over the left menu bar. |
3. | Click Settings. |
4. | Under Online Access, set the Cache This Module to Allow for Offline Access toggle to ON. |
5. | At the bottom of the page, click Save Settings. |
6. | Save your module. |
TIP To learn more about enabling offline access, search Introduction to Offline Mode in our In-Product Help.
Configure the Initializer Component
The Initializer component triggers the Browser Storage component that retrieves submission data from the browser.
1. | Drag and drop an Initializer component onto your canvas. |
2. | In the Property ID and Canvas Label Text fields, enter initGetOfflineSubmissions. |
3. | Select New Submission as the Trigger Type. |
4. | In the Outputs table, enter the following: |
Property ID | Type | Value |
---|---|---|
readOfflineSubmissions |
trigger |
GO |
NOTE This Property ID matches the Browser Storage component you set up next.
5. | Click Save. |
Configure the Browser Storage Component
To pull the data from your browser’s storage, use a Browser Storage component. Select the Read operation to view those offline submissions.
1. | Drag and drop a Browser Storage component onto your canvas. Place the component below your Initializer component. |
2. | In the Property ID and Canvas Label Text fields, enter readOfflineSubmissions. |
3. | Select Read as the Operation Type. |
4. | In the Namespace field, enter inspections5ffddf6ae336b802494437c8. |
5. | In the Outputs table, enter the following: |
Property ID | Mapping |
---|---|
hiddenOfflineSubmissions |
|
NOTE This Property ID matches the Hidden component you set up next.
6. | Click Save. |
Configure the Hidden Component
Now, add a Hidden component to store offline submissions made by your end-user.
1. | Drag and drop a Hidden component onto your canvas. Place your Hidden component below your Browser Storage component. |
2. | In the Property ID and Canvas Label Text fields, enter hiddenOfflineSubmissions. |
3. | Click Save. |
4. | Save your module. |
Preview your module in Express View, and open the DevTools console. Open the object to see the submission data created from the front-end source module.
Structure of a Browser Storage Component's Data
The IndexedDB stores data in an array of row objects.
Best Practices
It's best practice to use your module's unique module ID in the Browser Storage component's Namespace. For example, inspections5ffddf6ae336b802494437c8, where 5ffddf6ae336b802494437c8 is the module ID of the front-end source module. The Namespace is where the source module stored its data on the browser.
Editing a Browser Storage Component's Settings
You can revisit and make changes to your saved component's settings.
1. | In the Module Editor hover over the Browser Storage component. |
A 5-button toolbar displays above the component on hover-over.
2. | Using the toolbar, click the ![]() |
3. | Using the Configuration window, make changes to the component’s settings as needed. |
4. | Click Save. |
5. | Save your module. |
Moving a Browser Storage Component
You can move your component to a new position on your canvas.
1. | Hover over the Browser Storage component. |
A 5-button toolbar displays above the component on hover-over.
2. | Click and drag the ![]() |
3. | Save your module. |
Copying a Browser Storage Component
You can make a copy of your component using the Copy and Paste tools. Copy and Paste creates an exact copy of your component, matching all settings. The only noticeable difference between the two components is the Property ID. The Property ID on the new component automatically updates. Remember, every component must have a unique Property ID. Property IDs are the main method used to track and connect components in Unqork.
1. | Hover over the Browser Storage component. |
A 5-button toolbar displays above the component on hover-over.
2. | Click the ![]() |
3. | Click the ![]() |
4. | Update the copied component’s settings, if needed. |
5. | Click Save. |
6. | Save your module. |
Removing a Browser Storage Component
You can remove your component from the module.
1. | Hover over the Browser Storage component. |
A 5-button toolbar displays above the component on hover-over.
2. | Click the ![]() |
3. | Save your module. |
Resources