Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Atom<T>

Mutable wrapper for an (usually) immutable value. Support for watches.

Type parameters

  • T

Hierarchy

  • Atom

Implements

Index

Constructors

constructor

  • new Atom(val: T, valid?: Predicate<T>): Atom

Properties

Protected _value

_value: T

Protected _watches

_watches: any

Protected valid

valid: Predicate<T> | undefined

Accessors

value

  • get value(): T
  • set value(val: T): void

Methods

addWatch

  • addWatch(id: string, fn: Watch<T>): boolean

deref

  • deref(): T

equiv

  • equiv(o: any): boolean

notifyWatches

  • notifyWatches(old: T, prev: T): void

release

  • release(): boolean

removeWatch

  • removeWatch(id: string): boolean

reset

  • reset(val: T): T

resetIn

  • resetIn(path: Path0, val: T): T
  • resetIn<A>(path: Path1<T, A>, val: PathVal<T, [A]>): T
  • resetIn<A, B>(path: Path2<T, A, B>, val: PathVal<T, [A, B]>): T
  • resetIn<A, B, C>(path: Path3<T, A, B, C>, val: PathVal<T, [A, B, C]>): T
  • resetIn<A, B, C, D>(path: Path4<T, A, B, C, D>, val: PathVal<T, [A, B, C, D]>): T
  • resetIn<A, B, C, D, E>(path: Path5<T, A, B, C, D, E>, val: PathVal<T, [A, B, C, D, E]>): T
  • resetIn<A, B, C, D, E, F>(path: Path6<T, A, B, C, D, E, F>, val: PathVal<T, [A, B, C, D, E, F]>): T
  • resetIn<A, B, C, D, E, F, G>(path: Path7<T, A, B, C, D, E, F, G>, val: PathVal<T, [A, B, C, D, E, F, G]>): T
  • resetIn<A, B, C, D, E, F, G, H>(path: Path8<T, A, B, C, D, E, F, G, H>, val: PathVal<T, [A, B, C, D, E, F, G, H]>): T
  • resetIn<A, B, C, D, E, F, G, H>(path: DeepPath<T, A, B, C, D, E, F, G, H>, val: any): T

resetInUnsafe

  • resetInUnsafe(path: Path, val: any): T

swap

  • swap(fn: SwapFn<T, T>, ...args: any[]): T

swapIn

  • swapIn<A>(path: Path0, fn: SwapFn<T, T>, ...args: any[]): T
  • swapIn<A>(path: Path1<T, A>, fn: SwapFn<OptPathVal<T, [A]>, PathVal<T, [A]>>, ...args: any[]): T
  • swapIn<A, B>(path: Path2<T, A, B>, fn: SwapFn<OptPathVal<T, [A, B]>, PathVal<T, [A, B]>>, ...args: any[]): T
  • swapIn<A, B, C>(path: Path3<T, A, B, C>, fn: SwapFn<OptPathVal<T, [A, B, C]>, PathVal<T, [A, B, C]>>, ...args: any[]): T
  • swapIn<A, B, C, D>(path: Path4<T, A, B, C, D>, fn: SwapFn<OptPathVal<T, [A, B, C, D]>, PathVal<T, [A, B, C, D]>>, ...args: any[]): T
  • swapIn<A, B, C, D, E>(path: Path5<T, A, B, C, D, E>, fn: SwapFn<OptPathVal<T, [A, B, C, D, E]>, PathVal<T, [A, B, C, D, E]>>, ...args: any[]): T
  • swapIn<A, B, C, D, E, F>(path: Path6<T, A, B, C, D, E, F>, fn: SwapFn<OptPathVal<T, [A, B, C, D, E, F]>, PathVal<T, [A, B, C, D, E, F]>>, ...args: any[]): T
  • swapIn<A, B, C, D, E, F, G>(path: Path7<T, A, B, C, D, E, F, G>, fn: SwapFn<OptPathVal<T, [A, B, C, D, E, F, G]>, PathVal<T, [A, B, C, D, E, F, G]>>, ...args: any[]): T
  • swapIn<A, B, C, D, E, F, G, H>(path: Path8<T, A, B, C, D, E, F, G, H>, fn: SwapFn<OptPathVal<T, [A, B, C, D, E, F, G, H]>, PathVal<T, [A, B, C, D, E, F, G, H]>>, ...args: any[]): T
  • swapIn<A, B, C, D, E, F, G, H>(path: DeepPath<T, A, B, C, D, E, F, G, H>, fn: SwapFn<any, any>, ...args: any[]): T
  • Type parameters

    • A

    Parameters

    • path: Path0
    • fn: SwapFn<T, T>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    Parameters

    • path: Path1<T, A>
    • fn: SwapFn<OptPathVal<T, [A]>, PathVal<T, [A]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    Parameters

    • path: Path2<T, A, B>
    • fn: SwapFn<OptPathVal<T, [A, B]>, PathVal<T, [A, B]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    Parameters

    • path: Path3<T, A, B, C>
    • fn: SwapFn<OptPathVal<T, [A, B, C]>, PathVal<T, [A, B, C]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • path: Path4<T, A, B, C, D>
    • fn: SwapFn<OptPathVal<T, [A, B, C, D]>, PathVal<T, [A, B, C, D]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • path: Path5<T, A, B, C, D, E>
    • fn: SwapFn<OptPathVal<T, [A, B, C, D, E]>, PathVal<T, [A, B, C, D, E]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • path: Path6<T, A, B, C, D, E, F>
    • fn: SwapFn<OptPathVal<T, [A, B, C, D, E, F]>, PathVal<T, [A, B, C, D, E, F]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • path: Path7<T, A, B, C, D, E, F, G>
    • fn: SwapFn<OptPathVal<T, [A, B, C, D, E, F, G]>, PathVal<T, [A, B, C, D, E, F, G]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    Parameters

    • path: Path8<T, A, B, C, D, E, F, G, H>
    • fn: SwapFn<OptPathVal<T, [A, B, C, D, E, F, G, H]>, PathVal<T, [A, B, C, D, E, F, G, H]>>
    • Rest ...args: any[]

    Returns T

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    Parameters

    • path: DeepPath<T, A, B, C, D, E, F, G, H>
    • fn: SwapFn<any, any>
    • Rest ...args: any[]

    Returns T

swapInUnsafe

  • swapInUnsafe(path: Path, fn: SwapFn<any, any>, ...args: any[]): T

Generated using TypeDoc