Login to follow
Lightweight State Manager

Lightweight State Manager (ODC)

Stable version 0.1.2 (Compatible with ODC)
Uploaded on 21 Jun (3 weeks ago) by Harry Shyket
Lightweight State Manager

Lightweight State Manager (ODC)

Documentation
0.1.2

After importing the StateManager_Lib, it will provide Blocks that can be imported into your application.

The library provides two kinds of states, Atoms and Maps. The state can be persisted across screens as long as the page is not refreshed.


Review the demo app for implementation examples.


Atoms:

Atoms are single value items. The library currently stores them as text, but you can convert other single formats to text before storing them.

Maps:

Maps are a flat key-value structure. They allow storing the whole structure and then listening for changes on the whole structure or specific keys.


Subscribe

Automatically grab the latest value that is in the store.

Listen

Begins subscribing to the store but only grabs the value the first time the store changes.

CreateAtom/CreateMap

This will create the store and add the object.

RemoveStore

Deletes the store.

CheckStore

Checks if the store has a value. It will keep checking for a few retries (in case another component is loading at the same time and hasn't initialized yet).


The following blocks are available depending on your subscription method and object type.

  • SubscribeAtom
  • ListenAtom
  • SubscribeMap
  • ListenMap
  • SubscribeKeys
  • ListenKeys