Nocturnal Programmer's Machine

    @harlem/extension-reset
    TypeScript icon, indicating that this package has built-in type declarations

    2.3.6 • Public • Published

    Harlem Reset Extension

    npm

    This is the official reset extension for Harlem. The reset extension adds the ability to reset a store back to it's initial state.

    Getting Started

    Follow the steps below to get started using the reset extension.

    Installation

    Before installing this extension make sure you have installed @harlem/core.

    yarn add @harlem/extension-reset
    # or
    npm install @harlem/extension-reset

    Registration

    To get started simply register this extension with the store you wish to extend.

    import resetExtension from '@harlem/extension-reset';
    
    import {
        createStore
    } from '@harlem/core';
    
    const STATE = {
        firstName: 'Jane',
        lastName: 'Smith'
    };
    
    const {
        state,
        getter,
        mutation,
        reset
    } = createStore('example', STATE, {
        extensions: [
            resetExtension()
        ]
    });

    The reset extension adds a single reset method to the store instance.

    Usage

    Resetting a store

    to reset a store simply call the reset method returned from the store instance.

    Install

    npm i @harlem/extension-reset

    Homepage

    harlemjs.com

    DownloadsWeekly Downloads

    88

    Version

    2.3.6

    License

    MIT

    Unpacked Size

    1.54 MB

    Total Files

    16

    Last publish

    Collaborators

    • andrewcourtice