Skip to content
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

Closed
wants to merge 98 commits into from
Closed

V2 🚀 #16

wants to merge 98 commits into from

Conversation

garronej
Copy link
Owner

@garronej garronej commented Dec 5, 2020

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:

  • Get rid of the need to add the $ when attaching with operator.
  • Support for async operators ( other than with "evt/asyncPipe").
  • Make the operators way more simple.
  • Create 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.state
  • StatefulEvt: Get rid of evtDiff, evtChange, evtChangeDiff, provide operators to polifill this behaviour.
  • Re-write the doc with meaningful examples.
  • Support DOM observable like ResizeObserver like Evt.from(ctx, ResizeObserver, htmlElement).attach(...)
  • Ctx All handler added with a .done() Ctx should be immediately detached.
  • Get read of VoidEvt and VoidCtx now that we can just use Evt<void> and Ctx<void>
  • Way (via an operator) to get from an evt a new instance that only postAsyncOnceHandled.
  • Clean way for performing side effect in operators.
  • 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
  • Use getter and setter instead of weird workaround for backward compatibility.
  • Export evt/tools/typeSafety into a separate module tsafe
  • There is a bug in UnpackEvt UnpackEvt<Evt<string | undefined>> is string instead of being string | undefined
  • Decide if pipe on statefull event should should internally call evt.state = x or evt.post(x). (see comment, currently it calls post)
  • We should be able to create StatefullEvt where the initial state is only computer when accessed Evt.create(()=> "initial state" )
  • ctx.evtDoneOrAborted() should be a StatefulEvt

Trade offs:

Dropped backward compatibility with typescript 3.4.
EVT now requires a version of TypeScript >= 3.8 (February 20th, 2020)

@garronej garronej marked this pull request as draft December 5, 2020 12:39
@garronej
Copy link
Owner Author

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);

@garronej
Copy link
Owner Author

garronej commented Jun 5, 2022

image

Fix Evt.factorize when there is undefined in the union

@garronej garronej closed this Jul 17, 2022
@garronej garronej deleted the v2_beta branch July 17, 2022 01:53
gitbook-com bot pushed a commit that referenced this pull request Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant