Skip to main content

Introduction

GitHub Licensenpm versionnpm minified sizenpm total downloads

Global State and Logic Library

โ“ coreโ€‹

As the name suggests, the core is the main package of AgileTs. It contains the core API for State Management with AgileTs, which includes, for example, handy classes like:

  • โšก๏ธ Stateโ€‹

    A State represents a piece of Information that we need to remember globally at a later point in time. While offering a toolkit to use and mutate this piece of Information.

    const MY_STATE = createState("Hello there");

    // Update current State value
    MY_STATE.set("hi");

    // Undo latest State value change
    MY_STATE.undo();
  • ๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Collectionโ€‹

    A Collection represents a reactive set of Information that we need to remember globally at a later point in time. While offering a toolkit to use and mutate this set of Information.

    const MY_COLLECTION = createCollection();

    // Add Data to Collection
    MY_COLLECTION.collect({id: 1, name: "frank"});

    // Remove Data at primary Key '1' from Collection
    MY_COLLECTION.remove(1).everywhere();
  • ๐Ÿค– Computedโ€‹

    A Computed is an extension of the State Class that computes its value from a specified function.

     const MY_COMPUTED = createComputed(() => {
    return MY_STATE_1.value + MY_STATE_2.value;
    });

However, to make the whole State Management API work well, the core does a lot under the hood.

  • queue Agile Sub Instance changes in the runtime to prevent race conditions
  • update/rerender subscribed UI-Components through the provided Integrations such as the React Integration
  • integrate with the persistent Storage

These internal tasks are centrally managed by a so called Agile Instance.