Closed garronej closed 2 years ago
import { Evt } from "evt";
const obj = { "foo": 33 };
const evt = Evt.create(obj);
evt.attach(o=> console.log("1", o.foo));
evt.pipe(o => [o.foo]).attach(foo=> console.log("2", foo));
//evt.state = { "foo": 33};
//evt.postForceChange([obj]);
//evt.state = obj;
evt.post(obj);
Fix Evt.factorize
when there is undefined
in the union
Install 2.0 beta now:
npm install --save evt@beta
yarn add evt@beta
If you wish to use v2 beta on Deno, don't hesitate to ping me I will publish it somehow.
Roadmap:
$
when attaching with operator."evt/asyncPipe"
).SelfManaged
operators for more complex operation.StatefulEvt
: When attaching the handler should immediately be triggered with the state value.StatefulEvt
evt.state= x only triggers evt.post(x) if x !== evt.stateStatefulEvt
: Get rid ofevtDiff
,evtChange
,evtChangeDiff
, provide operators to polifill this behaviour.Evt.from(ctx, ResizeObserver, htmlElement).attach(...)
Ctx
All handler added with a.done()
Ctx
should be immediately detached.VoidEvt
andVoidCtx
now that we can just useEvt<void>
andCtx<void>
evt
a new instance that onlypostAsyncOnceHandled
.Evt.prototype.isHandledByOp()
(Evt.prototype.getStatelesOp()
replaced byEvt.prototype.getInvocableOp()
)evt/hooks/useStatefullEvt
renameduseRerenderOnStateChange
evt/tools/typeSafety
into a separate moduletsafe
UnpackEvt
UnpackEvt<Evt<string | undefined>>
isstring
instead of beingstring | undefined
evt.state = x
orevt.post(x)
. (see comment, currently it calls post)Evt.create(()=> "initial state" )
Trade offs:
Dropped backward compatibility with typescript 3.4.
EVT now requires a version of TypeScript >= 3.8 (February 20th, 2020)