Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides methods for storing information on the client's machine. The persistence period will vary based on the storage type and configuration.

Importing

// esm
import { stores } from '@paychex/platform-browser';
// commonjs
const { stores } = require('@paychex/platform-browser');
// amd
define(['@paychex/platform-browser'], function({ stores }) { ... });
require(['@paychex/platform-browser'], function({ stores }) { ... });
// iife
const { stores } = window['@paychex/platform-browser'];

Index

Functions

  • A persistent store whose objects are retained between visits.

    NOTE: Objects are serialized to JSON during storage to ensure any modifications to the original object are not reflected in the cached copy as a side-effect. Retrieving the cached version will always reflect the object as it existed at the time of storage. However, some property types cannot be serialized to JSON. For more information, read this.

    example
    const reports = stores.indexedDB({store: 'reports'});

    export async function loadReport(id) {
    const result = await someDataCall(id);
    await reports.set(id, result);
    return result;
    }

    Parameters

    Returns Store

    A Store backed by IndexedDB.

  • A persistent store that keeps data between site visits.

    NOTE: Objects are serialized to JSON during storage to ensure any modifications to the original object are not reflected in the cached copy as a side-effect. Retrieving the cached version will always reflect the object as it existed at the time of storage. However, some property types cannot be serialized to JSON. For more information, read this.

    example
    import { user } from '~/currentUser';

    const store = browser.stores.localStore();
    const persistentData = core.stores.utils.withPrefix(store, user.guid);

    export async function loadSomeData() {
    return await persistentData.get('some.key');
    }

    Returns Store

    A Store backed by the browser's localStorage Storage provider.

  • A persistent store whose data will be deleted when the browser window is closed. However, the data will remain during normal navigation and refreshes.

    NOTE: Objects are serialized to JSON during storage to ensure any modifications to the original object are not reflected in the cached copy as a side-effect. Retrieving the cached version will always reflect the object as it existed at the time of storage. However, some property types cannot be serialized to JSON. For more information, read this.

    example
    import { user } from '~/currentUser';

    const store = browser.stores.sessionStore();
    const data = core.stores.utils.withPrefix(store, user.guid);

    export async function loadSomeData() {
    return await data.get('some.key');
    }

    Returns Store

    A Store backed by the browser's sessionStorage Storage provider.