Warning: Use of undefined constant MDB_STRIPE_SUB_WEBHOOK_SECRET - assumed 'MDB_STRIPE_SUB_WEBHOOK_SECRET' (this will throw an Error in a future version of PHP) in /var/www/tst02/wp-content/themes/mdbootstrap4/inc/mdb-subscriptions/mdb-payments/stripe/class-mdb-stripe-webhook.php on line 26

Warning: Use of undefined constant MDB_PAYPAL_WEBHOOK_ID - assumed 'MDB_PAYPAL_WEBHOOK_ID' (this will throw an Error in a future version of PHP) in /var/www/tst02/wp-content/themes/mdbootstrap4/inc/mdb-subscriptions/mdb-payments/paypal/class-mdb-paypal-webhook.php on line 23

Notice: Undefined index: HTTP_REFERER in /var/www/tst02/wp-content/themes/mdbootstrap4/inc/cookie-setter.php on line 8
Bootstrap Storage management - examples & tutorial

Storage management MDB Pro component

Bootstrap 5 Storage management plugin

Storage component allows you to manage data stored in the browser's memory. Thanks to the component, you can easily add, delete, get data and check their expiration time.

Note: Read the API tab to find all available options and advanced customization


Basic example

The Storage Component provides methods to add, remove and get Storage.

Set Storage

Use the method Storage.set() to add data to storage. You can test this method using the example below. The button will call Storage.set('date', new Date());. To use this example again, press the reset button.

Set the expiration time

You can set the expiration time (in days) of saved data in local storage

Get storage

If you have saved any data in the storage, you can load them using the Storage.get method.

Remove Storage

When the data saved in storage are no longer needed and you want to delete them, use Storage.remove method.

Check Storage

You can set a task to check if the data has expired, delete it and set callback function. Set data name, the interval (in minutes) on how often to check expires date, and callback fn.


Advanced example

Show Modal for new users

Using the showModalNewUser method you can display the modal for new users. Click start button to start simulate this behavior. After next click modal don't show any more until you click reset.

Show modal after next visit

If you want to display the modal to the person who will visit the page again, you can use the showModalScoring method. Enter as a parameter the information after how many visits to the website the modal should appear. Click start button 3 times to test this feature.

Storage management - API


Usage

Via JavaScript


        Storage.set('date', new Date(), 1);
      

Methods

Name Description Example
set Add new data to local storage Storage.set( ... )
get Get data from local storage Storage.get( ... )
remove Remove data from local storage Storage.remove( ... )
check Check the data has not expired Storage.check( ... )

        Storage.set('name', 'value', 1);
      

Import

MDB UI KIT also works with module bundlers. Use the following code to import this component:


        import { Storage } from 'mdb-ui-kit';