Closed ds300 closed 1 year ago
Initial thoughts
new Atom(name, val, opts?)
atom(name, val, opts?)
new Derivation(name, derive, opts?)
computed(name, val, opts)
@derivation
@computed(opts?)
@atom(opts?)
useDeepComparisons
isEqual
lodash.isEqual
.get()
.set(val)
.value
.value = val
.set()
diffSinceEpoch(epoch)
getDiffSince(epoch)
Atom#update
buildIncrementalDerivation
We should avoid exposing the classes Atom and Derivation and create interfaces for the public API parts to avoid folks relying on implementation details.
tldraw/tldraw-lite#964
Initial thoughts
new Atom(name, val, opts?)
=>atom(name, val, opts?)
new Derivation(name, derive, opts?)
=>computed(name, val, opts)
@derivation
=>@computed(opts?)
@atom(opts?)
useDeepComparisons
withisEqual
option, to avoid depending onlodash.isEqual
(also prevents bundle bloat for folks using lodash already).get()
and.set(val)
with.value
and.value = val
, or just replace.get()
and leave.set()
alone.diffSinceEpoch(epoch)
=>getDiffSince(epoch)
Atom#update
, barely useful, a smaller api is more valuable.buildIncrementalDerivation