From 08ed3d406f178f372899fd76b982bf20597756c1 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Sat, 19 Apr 2025 18:49:32 +0300 Subject: Impl generics on dispatch/subscription arguments. --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index ce96c00..7e82c14 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ app.subscribe("$.counter", (state) => { }; }); -app.subscribe("request", (state) => { +app.subscribe<[]>("request", (state) => { return { state: { ...state, @@ -95,11 +95,14 @@ Subscriptions listen to events or changes to state. Each subscription must retur You can listen to events like so: ```typescript -app.subscribe("some-event-name", (state, arg1, arg2, arg3) => { - return { - state, - }; -}); +app.subscribe( + "some-event-name", + (state, arg1: string, arg2: string, arg3: string) => { + return { + state, + }; + } +); ``` Each subscription has a callback function which gets passed to it the app state and whatever data was passed -- cgit v1.2.3