MCPcopy
hub / github.com/tldraw/tldraw / Atom

Interface Atom

packages/state/src/lib/Atom.ts:52–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 * @public
51 */
52export interface Atom<Value, Diff = unknown> extends Signal<Value, Diff> {
53 /**
54 * Sets the value of this atom to the given value. If the value is the same as the current value, this is a no-op.
55 *
56 * @param value - The new value to set.
57 * @param diff - The diff to use for the update. If not provided, the diff will be computed using {@link AtomOptions.computeDiff}.
58 */
59 set(value: Value, diff?: Diff): Value
60 /**
61 * Updates the value of this atom using the given updater function. If the returned value is the same as the current value, this is a no-op.
62 *
63 * @param updater - A function that takes the current value and returns the new value.
64 */
65 update(updater: (value: Value) => Value): Value
66}
67
68/**
69 * Internal implementation of the Atom interface. This class should not be used directly - use the {@link atom} function instead.

Callers 16

getMethod · 0.65
annotateErrorFunction · 0.65
LruCache.test.tsFile · 0.65
setTimeoutMethod · 0.65
setIntervalMethod · 0.65
requestAnimationFrameMethod · 0.65
createMutatorsFunction · 0.65
mutators.test.tsFile · 0.65
updateCommittedDataMethod · 0.65

Implementers 5

__Atom__packages/state/src/lib/Atom.ts
AtomMappackages/store/src/lib/AtomMap.ts
EditorAtompackages/editor/src/lib/utils/EditorAt
EditorAtomtemplates/image-pipeline/src/utils.ts
EditorAtomtemplates/workflow/src/utils.ts

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…