New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 🚀 #16
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)