Skip to content

Local storage middleware for stores #64

@agubler

Description

@agubler

Enhancement

A middleware for stores that can be used to persist sections of state to LocalStorage and provides a mechanism to load from LocalStorage.

// usage in a process

import { collector } from '@dojo/framework/stores/middleware/localStorage';

const localStorageCollector = collector<State>(
    'local-storage-key',
    (paths) => {
        return [
            path('my', 'state', 'path'),
            path('my', 'other', 'state', 'path')
        ];
    }
);

const process = createProcess('example', [ command ], localStorageCollector);
// usage to load local storage state

import { load } from '@dojo/framework/stores/middleware/localStorage';

load('local-storage-key', store);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestnextIssue/Pull Request for the next major version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions