Files
marqdo/examples/browser-hello/fetch.mq.md
T
cflmyandCursor 687c168014 feat(parse): use nested YAML import: maps instead of one-liner binds
Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target
entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the
old one-liner form, and migrate lib/ext/examples/tests/docs accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 19:33:58 +08:00

887 B

title, description, import
title description import
browser fetch (C4) fetch/after effects via lib/browser — no json glue
browser
lib/browser.mq.md

main

wire =

@ 选择器 事件 调用
1 "#load" click load
2 "#ping" click ping

wire

load

msg = > browser.set_text sel="#status" text="loading…" req = > browser.fetch url="https://httpbin.org/uuid" then="on_uuid" > browser.merge a=msg b=req

on_uuid

+ `ok`
+ `status`
+ `body`=""
+ `error`=""
  1. ok > browser.set_text sel="#status" text=body
    > browser.set_text sel="#status" text="fetch failed"

ping

msg = > browser.set_text sel="#status" text="wait 600ms…" t = > browser.after ms=600 then="on_ping" > browser.merge a=msg b=t

on_ping

+ `ok`=True

> browser.set_text sel="#status" text="pong"