Batteries
Net & resources
Accent
Scheme
Backdrop motion
Batteries

Net & resources

net.*, resources and tasks with pending and failure.

net

Requests from the page. Every call waits and can fail, and none says async or await. These ask for files in public/, which ship beside the page as they are.
net.getJSON in, json out. The let's type is the shape the rows take.
Nothing asked for yet.
net.text and net.bytesThe same request, read as text or as bytes. Bytes have a url(): here they are shown as the picture they are.
Nothing asked for yet.
HeadersA last argument {headers: {…}} is passed to fetch, on any of the calls. A file server ignores them: an API reads them.
x-asked-bya header of our own
sent with the request
accept: application/json x-asked-by: the playground
post, put, del: failing, and handledNothing here can take a write: a file server answers 404 or 405, or with something that is not JSON. Each call says what to do then with else err => …, and the page goes on.
Press one: the failure arrives as words, not as a broken page.

Resources and tasks

A resource is a value loaded in the background. A task is statements that run when its part of the page opens.
resource … elseIt loads at once, and again whenever the state its call reads changes. Its else is its value until then, and on failure.
the call now
net.get("net-planets.json")
pending(bodies)false
failed(bodies)false
8 rows
namekindradius, kmmoons
Mercuryplanet24400
Venusplanet60520
Earthplanet63711
Marsplanet33902
Jupiterplanet6991195
Saturnplanet58232146
Uranusplanet2536228
Neptuneplanet2462216
task loadA named task runs when the page opens and is also an action: call it again, and ask after it with pending and failure.
Ask for a file that is not therenet-note.txt
pending(load)false
ran 1 time
what it loaded last
This is public/net-note.txt. A file in public/ beside the entry ships as it is, and net.text reads it as text.
x? and x else fallbackA call that can fail must be settled where it is made: pass it on with ?, or say what to have instead.
Two of these files exist and two do not. None of the four stops the action.

Actions that wait

pending, failed and failure work on an action as on a resource.
fail("…")?, pending(save), failure(save)With no title the action ends itself with fail. With one it reads a file, then posts to a server that is not there: the ? stops it, and failure(save) has the words.
pending(save)false
failed(save)false
Press Save with the field empty, then with a title.
esc
Pages
StartStart
Buttons & badgesComponents
Cards & disclosureComponents
Dialogs & drawersComponents
Menus & commandsComponents
Dates & tablesComponents
ChartsComponents
Chart galleryComponents
FieldsComponents
ChoicesComponents
DisplayComponents
NavigationComponents
Popovers & sheetsComponents
MessagesChat & AI
Prompt inputChat & AI
Reasoning & toolsChat & AI
Developer partsChat & AI
ConversationChat & AI
Code artifactsChat & AI
VoiceChat & AI
Code blocksChat & AI
MarkdownChat & AI
EditorElements
TerminalElements
FlowElements
3D boxesElements
PaintElements
SurfaceElements
MediaElements
IconsElements
PrimitivesElements
SQLBatteries
StorageBatteries
Net & resourcesBatteries
Crypto & bytesBatteries
ZipBatteries
TablesBatteries
PDFBatteries
TimeBatteries
ImagesBatteries
ScanBatteries
Video & audioBatteries
SearchBatteries
SyntaxBatteries
PatternsBatteries
NotifyBatteries
ShareBatteries
State & logicLanguage
WorkersLanguage
Events & elementsLanguage
StylingLanguage
RoutesLanguage
ShortcutsLanguage
Long listsLanguage
Failures & tryLanguage
Back endBack end
Models & writesBack end
Rules & failuresBack end
Jobs & schedulesBack end
Running itBack end
ExtensionsBack end
AIBack end
AnalyticsBack end
AboutAbout
↑↓move
↵open
676 places · ranked by BM25