Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Sep 10, 2023
1 parent b94fd4f commit 84378c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/StatefulEvt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { importProxy } from "./importProxy";
import { Evt, onAddHandlerByEvt } from "./Evt";
import type { CtxLike, StateDiff, NonPostableEvt, StatefulReadonlyEvt } from "./types";
import { assert } from "tsafe/assert";
import { id } from "tsafe/id";

/** https://docs.evt.land/api/statefulevt */
export type StatefulEvt<T> = import("./types/interfaces").StatefulEvt<T>;
Expand Down Expand Up @@ -34,7 +35,8 @@ class StatefulEvtImpl<T> extends Evt<T> implements StatefulEvt<T> {
return;
}

let sideEffect: (()=> void) | undefined = undefined;
let sideEffect= id<(()=> void) | undefined>(undefined);


const opResult = this.getInvocableOp(handler.op)(
this.__state,
Expand All @@ -44,7 +46,7 @@ class StatefulEvtImpl<T> extends Evt<T> implements StatefulEvt<T> {
if( this.setOpResultForPipe !== undefined ){
this.setOpResultForPipe(opResult);
if( sideEffect !== undefined ){
runSideEffect(sideEffect);
sideEffect();
}
}

Expand Down

0 comments on commit 84378c7

Please sign in to comment.