summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
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