You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ]: Use StatefulEvtLike in powerhooks instead of StatefulObservable.
//evtLikeToEvt.tsimporttype{NonPostableEvtLike,UnpackEvt,EvtLike}from"./types";import{importProxy}from"./importProxy";importtype{EvtLikeToEvt}from"./types";import{assert}from"tsafe/assert";import{is}from"tsafe/is";typeCtxLike<Result>=import("./types").CtxLike<Result>&{evtDoneOrAborted: NonPostableEvtLike<unknown>&{postCount: number;attachOnce(callback: ()=>void): void;};};exportfunctionevtLikeToEvt<EextendsNonPostableEvtLike<any>>(evtLike: E,ctx: CtxLike<any>): EvtLikeToEvt<E>{constevt="state"inevtLike ? importProxy.Evt.create((evtLikeasany).state) : importProxy.Evt.create();letdoSkip=false;evt.attach(ctx,data=>{//NOTE: We received an event so we know it's postable;assert(is<EvtLike<UnpackEvt<E>>>(evtLike));doSkip=true;evtLike.post(data);doSkip=false;});constctxForEvtLike=importProxy.Evt.newCtx();evtLike.attach(ctxForEvtLike,data=>{if(doSkip){return;}evt.post(data);});ctx.evtDoneOrAborted.attach(()=>ctxForEvtLike.done());returnevtasany;}
The text was updated successfully, but these errors were encountered:
[ ]: Use
StatefulEvtLike
in powerhooks instead ofStatefulObservable
.The text was updated successfully, but these errors were encountered: