v1 -> v2
New features and breaking changes
If you are only using the more commun features of Evt you can upgrade to v2 without facing any breaking change.
Most of the breaking changes are related to StatefulEvt and React integration.
Dropped backward compatibility with typescript 3.4.
EVT now requires a version of TypeScript >= 3.8 (February 20th, 2020)
  • fλ Operators return type is [U] | null (in v1: [U] | null | "DETACH" | {DETACH: Ctx} |...
  • StatefulEvt: When attaching the handler should immediately be triggered with the state value. (except with attachExtract, and other *extract* methods)
  • StatefulEvt evt.state= x only triggers evt.post(x) if x !== evt.state
  • Support DOM observable like ResizeObserver like Evt.from(ctx, ResizeObserver, htmlElement).attach(...)
  • Ctx All handler added with a .done() Ctx should are immediately detached.
  • Get read of VoidEvt and VoidCtx now that we can just use Evt<void> and Ctx<void>
  • Clean way for performing side effect in operators. See example.
  • Easy way to test if an event data is handled by a particular operator Evt.prototype.isHandledByOp() (Evt.prototype.getStatelesOp() replaced by Evt.prototype.getInvocableOp())
  • evt/hooks/useStatefullEvt renamed useRerenderOnStateChange
  • Export evt/tools/typeSafety into a separate module tsafe
Copy link
Edit on GitHub