Skip to content

Commit 10f92a6

Browse files
docs: Update runs.mdx (#327)
* docs: Update runs.mdx From what I can tell, it is expected for run functions to return with some sort of payload. Providing an example here as a reference and guideline. * Made it clear returning data is optional and added some more detail below --------- Co-authored-by: Matt Aitken <[email protected]>
1 parent b957aa1 commit 10f92a6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/documentation/concepts/runs.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ client.defineJob({
2323
// 1. Run function with params
2424
run: async (payload, io, ctx) => {
2525
// 2. Regular code and Tasks
26+
// 3. Optionally return data from run execution
27+
return { status: 'success' }
2628
},
2729
});
2830
```
2931

3032
1. The `run()` function is called with some useful parameters. More on that in a second.
3133
2. Inside the run function you can write regular code and use [Tasks](/documentation/concepts/tasks).
34+
3. You can return data, which will then be retrievable with [getRun](/sdk/triggerclient/instancemethods/getrun) or the [React hooks](/documentation/guides/react-hooks).
3235

3336
## Resumability
3437

0 commit comments

Comments
 (0)