diff --git a/docs/api/evt/use-effect.md b/docs/api/evt/use-effect.md index 74b5c621..8cf6f031 100644 --- a/docs/api/evt/use-effect.md +++ b/docs/api/evt/use-effect.md @@ -44,7 +44,7 @@ const evtText = Evt.create("foo"); Evt.useEffect( text=> console.log(text), - evtText.evtChange.statefulPipe(ctx) + evtText.evtChange.pipe(ctx) ); // Pints "foo" evtText.state= "bar"; // Prints "bar" diff --git a/docs/api/statefulevt.md b/docs/api/statefulevt.md index eed86e38..c0d2a13d 100644 --- a/docs/api/statefulevt.md +++ b/docs/api/statefulevt.md @@ -81,9 +81,9 @@ evtColor.state= "BLUE"; //Prints nothing evtColor.state= "WHITE"; //Prints "BLUE=>WHITE" ``` -## `.statefulPipe(...)` +## `.pipe(...)` -Same as [`evt.pipe(...)`](https://docs.evt.land/api/evt/pipe) but return a `StatefulEvt`. +Same as [`evt.pipe(...)`](https://docs.evt.land/api/evt/pipe) but return a `StatefulEvt`. Be aware that the current state of the `StatefulEvt` must be matched by the operator \( if any \) when invoking `.pipe()`, elst an exception will be thrown. ```typescript import { Evt } from "evt"; @@ -96,7 +96,7 @@ type Circle = {  const evtSelectedCircle = Evt.create({ "color": "RED", "radius": 3 }); const evtSelectedCricleColor = - evtSelectedCircle.statefulPipe(circle=> [ cicle.color ]); + evtSelectedCircle.pipe(circle=> [ cicle.color ]); evtSelectedCircleColor.attach(console.log); ``` @@ -131,7 +131,7 @@ const evtIsBigAndBlue = Evt.merge([ evtIsBig.evtChange ]) .toStateful() - .statefulPipe(()=> [ evtIsBlue.state && evtIsBig.state ]) + .pipe(()=> [ evtIsBlue.state && evtIsBig.state ]) ; console.log(evtIsBigAndBlue.state); // Prints "false" @@ -186,3 +186,18 @@ evtTick.post(2); // TS ERROR postForceChange(wData?: readonly [T]): number; ``` +## `.toStateless([ctx])` + +Return a stateless copy of the `Evt.` + +```typescript +import { Evt } from "evt"; + +const evtText= Evt.create("foo"); + +//x is Evt +const x= evtText.toStateless(); +``` + +`evt.toStateless()` is equivalent to `Evt.prototype.pipe.call(evt)` +