Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/content/docs/docs/create-a-widget/widget-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import { poll, fetchData, sparkline } from '/js/widget-toolbox.js?v=1';

- `widgetId()` returns this widget id from the frame URL.
- `fetchData(endpoint?, { params })` fetches `/api/widget-data/<id>` and returns the parsed JSON. Throws on a non-OK response. Each name in `params` must be listed in the manifest's [`params`](/docs/create-a-widget/manifest/#query-parameters).
- `readingTime(data)` returns when the service produced data that `fetchData` returned. While a slow refresh runs, the server can answer with the previous result, so use this, not `Date.now()`, for an "updated" label.
- `getConfig()` fetches this widget config, without secrets.

### Polling
Expand Down
Loading