diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-04-19 18:49:32 +0300 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-04-19 18:49:32 +0300 |
| commit | 08ed3d406f178f372899fd76b982bf20597756c1 (patch) | |
| tree | db7a69d8dbe770b333c6bb9cba715fb947a43d0a /README.md | |
| parent | 92ae308186773a8f8bfd013259aeeb31d27aaaa9 (diff) | |
Impl generics on dispatch/subscription arguments.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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 |
