Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Atom<S>

A data structure useful for providing a controlled, predictable mechanism for mutability. Allows multiple components of a program to share read/write access to some state in such a way that no component can mutate another component's current reference to the state in the middle of some process or asynchronous operation.

Type parameters

  • S

Hierarchy

  • Atom

Index

Methods

Methods

Static of

  • Constructs a new instance of Atom with its internal state set to state.

    example
    
    import { Atom } from '@libre/atom'
    
    const a1 = Atom.of(0)
    const a2 = Atom.of("zero")
    const a3 = Atom.of({ count: 0 })

    Type parameters

    • S

      the type of the value being set as an Atom's internal state

    Parameters

    Returns Atom<S>