State

Overview

This document provides a comprehensive list of all available state functions in the dphelper library along with their descriptions and examples.

Functions

state.[state.name] ex: state.test

  • Description: Set and get state values.

  • Example:

    // To set a state value
    state.name = 'value';
    
    // To get a state value
    const value = state.name;

state.list

  • Description: Show all states out of proxy.

  • Example:

    state.list;

state.remove([state.name])

  • Description: Remove a state.

  • Parameters:

    • name (string): The name of the state to remove.

  • Example:

    state.remove('stateName');

state.name.lock()

New option!

  • Description: Lock a state (only for types: Array, Object).

  • Example:

    state.name = {test:"test"}
    state.name.lock();
    "Now you can't add more data or remove it"

state.removeAll()

New option!

  • Description: Remove all states.

  • Example:

    state.name = {test:"test"}
    state.removeAll();
    "Now you can't see state.name (all states are removed)"
    "Use for Log-out / Sign-out operation"

License

This project is licensed under the MIT License.

Last updated