From 7880bdfe64591075ee796e6fc5c0dc2c0189b692 Mon Sep 17 00:00:00 2001 From: Garrone Joseph Date: Sun, 19 Apr 2020 19:38:46 +0000 Subject: [PATCH 1/2] GitBook: [master] one page modified --- docs/api/statefulevt.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/api/statefulevt.md b/docs/api/statefulevt.md index eed86e38..f89a893b 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); ``` @@ -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)` + From fde947e8fa1d75c949e382ad9db1d5f721fdf321 Mon Sep 17 00:00:00 2001 From: Garrone Joseph Date: Sun, 19 Apr 2020 19:42:13 +0000 Subject: [PATCH 2/2] GitBook: [master] 2 pages modified --- docs/api/evt/use-effect.md | 2 +- docs/api/statefulevt.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 f89a893b..c0d2a13d 100644 --- a/docs/api/statefulevt.md +++ b/docs/api/statefulevt.md @@ -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"