# xript — Full Documentation
> xript (eXtensible Runtime Interface Protocol Tooling) is a platform specification for making any application moddable through sandboxed JavaScript. A single manifest declares the bindings, capabilities, hooks, types, and slots a host exposes; everything else — TypeScript definitions, docs, validation — derives from it.
Source: https://xript.dev
----------------------------------------
# xript
Source: https://xript.dev/
export const manifestSample = `{
"xript": "0.7",
"name": "my-game",
"bindings": {
"player": {
"description": "The player character.",
"members": {
"getHealth": {
"description": "Current health points.",
"returns": "number"
},
"setHealth": {
"description": "Set the player's health.",
"params": [{ "name": "value", "type": "number" }],
"capability": "modify-player"
}
}
}
}
}`;
export const modSample = `const hp = player.getHealth()
const max = player.getMaxHealth()
log("Current HP: " + hp + "/" + max)
player.setHealth(max)
log("Healed to full! HP: " + player.getHealth())`;
Status: …
Check the logs.
Health: 0/0
``` ### Resolution 1. The fragment declares bindings mapping local names to host data paths 2. The runtime resolves each path against the host's data layer (e.g. `"player.health.val"` → traverse `data.player.health.val`) 3. For text elements (`span`, `div`, `p`, etc.): the runtime sets `textContent` 4. For input elements (`input`, `textarea`, `select`): the runtime sets `value` 5. On data change, the runtime re-resolves only changed bindings and patches the affected elements ### Performance `data-bind` attributes persist in the DOM. The runtime maintains a map of attribute → element references for O(1) updates. This supports 60fps update rates for game-loop-driven UI without template re-parsing or diffing. ### Two-Way Binding For input elements, the runtime can both push values (host → fragment) and listen for changes (fragment → host). Write-back is explicit: use the `handlers` array to declare handlers for `input` or `change` events on bound elements. ## Conditional Visibility: `data-if` The `data-if` attribute evaluates an expression against the binding context to control element visibility. ```html