FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
glance
glanceGlancer
Public
Like
Glancer
Home
Code
9
.vscode
1
backend
4
frontend
6
shared
1
.cursorrules
.vtignore
INSTRUCTIONS.md
README.md
deno.json
Branches
3
Pull requests
Remixes
2
History
Environment variables
5
Settings
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
/
backend
/
crons
/
_README.md
Code
/
backend
/
crons
/
_README.md
Search
…
_README.md

This directory has crons that extract data from Notion and save that data to blob storage in val.town. Blob storage functions like a cache.

demoCache.ts

Each /demo is a composite of many Notion calls. This cron hit Notion every minute to rebuild the /demo and store the results. When a user hits the /demo, Glancer has one query to make to build the demo, rather than having to loop through myriad queries to Notion. This keeps the /demo UX snappy.

demoCobrowseStatus.ts

This cron queries Notion to check the cobrowse status of a /demo. It stores the results as a blob.

When a /demo is loaded in the browser, an interval script (/shared/utils/pollEnabledStatus.ts) runs every second to poll the /cobrowse endpoint, which hits that blob, to check whether or not cobrowsing has been enabled for that demo. (If it's enabled, the cobrowse button is live and blue. If cobrowsing is disabled, the user sees a call-to-action to contact Glance.)

Hitting Notion every second would put excessive load on Notion and sometimes Notion is under load from other users at peak times. With this caching strategy, we don't have to hit Notion to check the status of cobrowing, because we hit the cache instead.

healthCheck.ts

This cron runs through all of the databases listed in the Glancer Val's environment variables, queries them, and stores the results in blob storage. The output is JSON rendered as HTML, in an HTTP Val.

We embed that HTTP Val into the Glancer app in Notion. This way, we can see the health of the integration between Notion and val.town from Notion, and it loads instantly, without having to query Notion.

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.