summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2025-04-19 18:49:32 +0300
committerAsko Nõmm <asko@nmm.ee>2025-04-19 18:49:32 +0300
commit08ed3d406f178f372899fd76b982bf20597756c1 (patch)
treedb7a69d8dbe770b333c6bb9cba715fb947a43d0a /README.md
parent92ae308186773a8f8bfd013259aeeb31d27aaaa9 (diff)
Impl generics on dispatch/subscription arguments.
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 9 insertions, 6 deletions
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