From 1a9481066ad2fc02ebe1fb6a2e37ab30918bc065 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Mon, 21 Apr 2025 12:03:36 +0300 Subject: Refactor dispatch parameter naming from 'withData' to 'with' for consistency --- src/shapex.test.ts | 2 +- src/shapex.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/shapex.test.ts b/src/shapex.test.ts index 5c555b0..55e38ae 100644 --- a/src/shapex.test.ts +++ b/src/shapex.test.ts @@ -161,7 +161,7 @@ describe("dispatch", () => { $.subscribe("parent-event", (state) => ({ state, - dispatch: { to: "nested-event", withData: "arg-value" }, + dispatch: { to: "nested-event", with: "arg-value" }, })); $.dispatch("parent-event"); diff --git a/src/shapex.ts b/src/shapex.ts index d36e5e4..0366934 100644 --- a/src/shapex.ts +++ b/src/shapex.ts @@ -4,7 +4,7 @@ */ export type SubscriptionResponseDispatch = { to: string; - withData?: W; + with?: W; }; /** @@ -258,15 +258,15 @@ export default function ShapeX( if (response.dispatch) { if (isSubscriptionResponseList(response.dispatch)) { for (const dispatchee of response.dispatch) { - if (dispatchee.withData) { - dispatch(dispatchee.to, dispatchee.withData); + if (dispatchee.with) { + dispatch(dispatchee.to, dispatchee.with); } else { dispatch(dispatchee.to); } } } else { - if (response.dispatch.withData) { - dispatch(response.dispatch.to, response.dispatch.withData); + if (response.dispatch.with) { + dispatch(response.dispatch.to, response.dispatch.with); } else { dispatch(response.dispatch.to); } -- cgit v1.2.3