FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
neverstew
neverstewinTheBackgroundExample
Public
Like
1
inTheBackgroundExample
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
main.tsx
https://neverstew--206f8a06278011f0b46e569c3dd06744.web.val.run
README.md

inTheBackground

With the addition of the "early return" feature of web handlers, you can now process short background tasks in vals. This can be really useful for occasions where an immediate response is required, with a subsequent update a few seconds later

e.g. a Discord bot that calls ChatGPT needs to respond within a few seconds, which can be too fast for the AI to generate a response. We can instead reply immediately and then update that message later, inTheBackground

Simply wrap something in inTheBackground and it will do just that! In this example, we log something a few seconds later than the web response is sent back.

HTTP
  • main.tsx
    neverstew--20…44.web.val.run
Code
README.md
H
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.