Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:
md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>Results
Theme Data
{
"search": {
"provider": "local"
},
"lastUpdated": {
"text": "Last updated: ",
"formatOptions": {
"dateStyle": "full"
}
},
"sidebar": [
{
"text": "USER MANUALS",
"collapsed": false,
"items": [
{
"text": "<img class=\"icon\" src=\"/icon/drone.svg\" /> RoBeeX AI Drone",
"collapsed": true,
"link": "/en/user-manuals/robeex-ai-drone/specification",
"items": [
{
"text": "📘 Specification",
"link": "/en/user-manuals/robeex-ai-drone/specification"
},
{
"text": "🛠️ Assembly",
"link": "/en/user-manuals/robeex-ai-drone/assembly"
},
{
"text": "🔋 Charging And Battery",
"link": "/en/user-manuals/robeex-ai-drone/charging-and-battery"
},
{
"text": "💾 Install Application",
"link": "/en/user-manuals/robeex-ai-drone/install-application"
},
{
"text": "👨💼 Account Managment",
"link": "/en/user-manuals/robeex-ai-drone/account-managment"
},
{
"text": "⚡ First Power Up",
"link": "/en/user-manuals/robeex-ai-drone/first-power-up"
},
{
"text": "🕹️ Manual Flight",
"link": "/en/user-manuals/robeex-ai-drone/manual-flight"
},
{
"text": "⚙️ Settings",
"link": "/en/user-manuals/robeex-ai-drone/settings"
},
{
"text": "🖼️ Gallery",
"link": "/en/user-manuals/robeex-ai-drone/gallery"
},
{
"text": "🔄 Update",
"link": "/en/user-manuals/robeex-ai-drone/update"
},
{
"text": "🎯 IMU Calibration",
"link": "/en/user-manuals/robeex-ai-drone/imu-calibration"
},
{
"text": "🤖 Autonomous Fligh",
"link": "/en/user-manuals/robeex-ai-drone/autonomous-fligh"
},
{
"text": "🧰 Troubleshoot",
"link": "/en/user-manuals/robeex-ai-drone/troubleshoot"
},
{
"text": "❓ FAQ",
"link": "/en/user-manuals/robeex-ai-drone/faq"
}
]
},
{
"text": "🔌 Expansion Boards",
"collapsed": true,
"link": "/en/user-manuals/expansion-boards/",
"items": []
}
]
},
{
"text": "PROGRAMMING",
"collapsed": false,
"items": [
{
"text": "<img class=\"icon\" src=\"/icon/blockly.png\" /> Blockly",
"collapsed": true,
"items": [
{
"text": "📚 Guides",
"collapsed": true,
"items": [
{
"text": "Introduction",
"link": "/en/programming/blockly/guides/introduction"
},
{
"text": "Blockly Editor Environment",
"link": "/en/programming/blockly/guides/blockly-editor-environment"
},
{
"text": "Making Your First Program",
"link": "/en/programming/blockly/guides/making-your-first-program"
},
{
"text": "Demo Programs",
"collapsed": true,
"link": "/en/programming/blockly/guides/demo-programs/run-or-duplicate",
"items": [
{
"text": "Run or Duplicate",
"link": "/en/programming/blockly/guides/demo-programs/run-or-duplicate"
},
{
"text": "Face Tracking",
"link": "/en/programming/blockly/guides/demo-programs/face-tracking"
}
]
}
]
},
{
"text": "🔍 References",
"collapsed": true,
"items": [
{
"text": "Overview",
"link": "/en/programming/blockly/references/overview"
},
{
"text": "Block Categories",
"collapsed": true,
"link": "/en/programming/blockly/references/block-categories/default-blocks",
"items": [
{
"text": "Default Blocks",
"link": "/en/programming/blockly/references/block-categories/default-blocks"
},
{
"text": "Flying",
"link": "/en/programming/blockly/references/block-categories/flying"
},
{
"text": "Machine Vision",
"link": "/en/programming/blockly/references/block-categories/machine-vision"
},
{
"text": "Lights",
"link": "/en/programming/blockly/references/block-categories/lights"
},
{
"text": "Sensors",
"link": "/en/programming/blockly/references/block-categories/sensors"
},
{
"text": "🔌 Expansion Boards",
"link": "/en/programming/blockly/references/block-categories/expansion-boards"
},
{
"text": "Timing",
"link": "/en/programming/blockly/references/block-categories/timing"
},
{
"text": "Text",
"link": "/en/programming/blockly/references/block-categories/text"
},
{
"text": "Logic",
"link": "/en/programming/blockly/references/block-categories/logic"
},
{
"text": "Loops",
"link": "/en/programming/blockly/references/block-categories/loops"
},
{
"text": "Math",
"link": "/en/programming/blockly/references/block-categories/math"
},
{
"text": "Lists",
"link": "/en/programming/blockly/references/block-categories/lists"
}
]
}
]
}
]
},
{
"text": "<img class=\"icon\" src=\"/icon/python.svg\" /> Python",
"collapsed": true,
"items": [
{
"text": "📚 Guides",
"collapsed": true,
"link": "/en/programming/python/guides/install-library",
"items": [
{
"text": "Install Library",
"link": "/en/programming/python/guides/install-library"
}
]
},
{
"text": "🔍 API References",
"collapsed": true,
"items": [
{
"text": "Overview",
"link": "/en/programming/python/api-references/overview"
},
{
"text": "Classes",
"collapsed": true,
"link": "/en/programming/python/api-references/classes/drone-bottom-flash-led-api",
"items": [
{
"text": "Drone Bottom Flash LED API",
"link": "/en/programming/python/api-references/classes/drone-bottom-flash-led-api"
},
{
"text": "Drone Nav API",
"link": "/en/programming/python/api-references/classes/drone-nav-api"
},
{
"text": "Drone Rgb LED API",
"link": "/en/programming/python/api-references/classes/drone-rgb-led-api"
},
{
"text": "RC API",
"link": "/en/programming/python/api-references/classes/rc-api"
},
{
"text": "<img class=\"icon\" src=\"/icon/drone.svg\" /> RoBeeX AI Drone",
"link": "/en/programming/python/api-references/classes/robeex-ai-drone"
},
{
"text": "UDP Video Stream",
"link": "/en/programming/python/api-references/classes/udp-video-stream"
}
]
},
{
"text": "Enums",
"collapsed": true,
"link": "/en/programming/python/api-references/enums/frame-size",
"items": [
{
"text": "Frame Size",
"link": "/en/programming/python/api-references/enums/frame-size"
},
{
"text": "Ignore Axis",
"link": "/en/programming/python/api-references/enums/ignore-axis"
},
{
"text": "Motor Number",
"link": "/en/programming/python/api-references/enums/motor-number"
},
{
"text": "Rgb Mode",
"link": "/en/programming/python/api-references/enums/rgb-mode"
}
]
}
]
}
]
},
{
"text": "<img class=\"icon\" src=\"/icon/arduino.svg\" /> Arduino",
"collapsed": true,
"link": "/en/programming/arduino/",
"items": []
}
]
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/RoBeeX-Robotics"
},
{
"icon": "youtube",
"link": "https://www.youtube.com/@RoBeeXRobotics"
},
{
"icon": "instagram",
"link": "https://www.instagram.com/robeex.iran"
}
],
"outline": {
"level": [
2,
3
],
"label": "Table of Contents"
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "en/dev/api-examples.md",
"filePath": "en/dev/api-examples.md",
"lastUpdated": 1783377392000
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.