Documentation / @debuffjp/dev / DevHooks
Interface: DevHooks
Defined in: dev/src/index.ts:96
The dev inspection and control surface, available as window.__DEBUFF_DEV__ in dev builds. Every method takes and returns JSON-serialisable values so browsers, CLIs and agents can call it.
Properties
controlled
readonlycontrolled:boolean
Defined in: dev/src/index.ts:99
True when the page was opened with ?debuff-scenario: the loop is stopped and time only advances via step.
version
readonlyversion:2
Defined in: dev/src/index.ts:97
Methods
capture()
capture(
fit?,background?):string
Defined in: dev/src/index.ts:174
PNG data URL of the current frame. With fit, the frame is letterboxed into that size: "social" (1200×675, for X and Bluesky posts and link cards) or [width, height], on background (default black).
Parameters
fit?
[number, number] | "social"
background?
string
Returns
string
checkpoint()
checkpoint():
object
Defined in: dev/src/index.ts:145
The game's state now, hashed part by part, to compare with a replay's checkpoint steps.
Returns
object
checkpoint
checkpoint:
Checkpoint
tick
tick:
number
clips()
clips(
on?):ClipStatus
Defined in: dev/src/index.ts:179
Turn rolling clip recording on or off (no argument: just report). While on, saveClip keeps the last few seconds. It runs two video encoders, so leave it off when you aren't capturing.
Parameters
on?
boolean
Returns
command()
command(
name, ...args):unknown
Defined in: dev/src/index.ts:194
Run a game command, e.g. to start a scenario at a checkpoint. Recorded in replays.
Parameters
name
string
args
...unknown[]
Returns
unknown
commands()
commands():
string[]
Defined in: dev/src/index.ts:192
Names of the commands the game registered with devTools({ commands }).
Returns
string[]
errors()
errors():
ExplainedError[]
Defined in: dev/src/index.ts:164
Runtime errors since load, explained: kind says whose problem it is ("your-code", "debuff-usage", "debuff-bug", "outside"), where points at the game's source, hint suggests a next step. Repeats are counted.
Returns
events()
events(
sinceTick?):GameEventRecord[]
Defined in: dev/src/index.ts:152
The latest game events (game.emit), oldest first, optionally only those after sinceTick.
Parameters
sinceTick?
number
Returns
frames()
frames(
n?):FrameSample[]
Defined in: dev/src/index.ts:133
The latest n frame breakdowns (update/render ms, steps, quads, draw calls, long tasks), oldest first.
Parameters
n?
number
Returns
keepForReload()
keepForReload():
void
Defined in: dev/src/index.ts:157
Save the session for a state-preserving reload (the debuff dev client calls this just before a code change reloads the page). After the reload the new code replays it to the same tick.
Returns
void
luminance()
luminance(
cols,rows,region?):number[]
Defined in: dev/src/index.ts:190
The current frame's relative luminance (0 black to 1 white, WCAG), averaged over a cols × rows grid, row by row. region ([x, y, w, h] in logical units) samples part of the screen. For flash and contrast checks in scenarios.
Parameters
cols
number
rows
number
region?
[number, number, number, number]
Returns
number[]
notes()
notes():
Note[]
Defined in: dev/src/index.ts:159
Moments the human flagged in the overlay, with the game state at that tick.
Returns
Note[]
pad()
pad(
state):void
Defined in: dev/src/index.ts:129
Feed gamepad state (pressed standard-mapping button indices, left stick axes); null = no pad, undefined = real pads again.
Parameters
state
PadStep | null | undefined
Returns
void
params()
params():
Record<string,ParamDescription>
Defined in: dev/src/index.ts:130
Returns
Record<string, ParamDescription>
pause()
pause():
DevState
Defined in: dev/src/index.ts:103
Returns
pointerDown()
pointerDown(
x,y,kind?):void
Defined in: dev/src/index.ts:119
Press the primary pointer at logical coordinates. kind (default "mouse") is what the game sees in pointer.kind: a "touch" or "pen" press is also a contact in pointer.touches (id 1), and a mouse press is only the primary pointer, so a drag never shows up as both.
Parameters
x
number
y
number
kind?
Returns
void
pointerMove()
pointerMove(
x,y):void
Defined in: dev/src/index.ts:120
Parameters
x
number
y
number
Returns
void
pointerUp()
pointerUp():
void
Defined in: dev/src/index.ts:121
Returns
void
press()
press(
code):void
Defined in: dev/src/index.ts:110
Hold a key (KeyboardEvent.code), or the right or middle mouse button as "PointerRight" / "PointerMiddle".
Parameters
code
string
Returns
void
profile()
profile():
Report&object
Defined in: dev/src/index.ts:138
myaku's report: frame-time percentiles, hitches per minute, and the worst hitches explained (cause, confidence, the script to look at, a hint), with debuff's update and render as spans.
Returns
Report & object
reducedMotion()
reducedMotion(
value):DevState
Defined in: dev/src/index.ts:108
Force game.reducedMotion on or off; null restores what it was. Returns the new state.
Parameters
value
boolean | null
Returns
release()
release(
code):void
Defined in: dev/src/index.ts:111
Parameters
code
string
Returns
void
replay()
replay(
toTick?):Replay
Defined in: dev/src/index.ts:143
Everything played since page load (keys, pointer, param changes) up to toTick (default: now), as a scenario that replays it exactly. Pass a note's tick to get the session leading up to that note.
Parameters
toTick?
number
Returns
resume()
resume():
DevState
Defined in: dev/src/index.ts:104
Returns
rewind()
rewind(
tick):void
Defined in: dev/src/index.ts:150
Reload and replay this session's inputs to tick, then pause there: the exact state at that moment. Within the known session you can go forward again, until new play branches off.
Parameters
tick
number
Returns
void
saveClip()
saveClip(
name?):Promise<SavedCapture>
Defined in: dev/src/index.ts:184
Save the last few seconds as a video in .debuff/captures/ (through debuff dev; downloaded otherwise). MP4 where the browser can record it, else WebM. Needs clips(true) first.
Parameters
name?
string
Returns
Promise<SavedCapture>
setParam()
setParam(
group,key,value):void
Defined in: dev/src/index.ts:131
Parameters
group
string
key
string
value
Returns
void
speed()
speed(
scale):void
Defined in: dev/src/index.ts:106
Simulation speed multiplier (1 = normal).
Parameters
scale
number
Returns
void
state()
state():
DevState
Defined in: dev/src/index.ts:102
Returns
step()
step(
steps?):DevState
Defined in: dev/src/index.ts:101
Advance steps fixed simulation steps (pausing first) and return the new state.
Parameters
steps?
number
Returns
tap()
tap(
x,y,kind?):void
Defined in: dev/src/index.ts:113
Press and release the primary pointer at logical coordinates across one step, as a mouse unless kind says otherwise.
Parameters
x
number
y
number
kind?
Returns
void
touchDown()
touchDown(
id,x,y,kind?):void
Defined in: dev/src/index.ts:125
Start a touch contact id at logical coordinates (a finger, or "pen"). The first contact also presses the primary pointer.
Parameters
id
number
x
number
y
number
kind?
"pen" | "touch"
Returns
void
touchMove()
touchMove(
id,x,y):void
Defined in: dev/src/index.ts:126
Parameters
id
number
x
number
y
number
Returns
void
touchUp()
touchUp(
id):void
Defined in: dev/src/index.ts:127
Parameters
id
number
Returns
void
typeErrors()
typeErrors():
TypeDiagnostic[]
Defined in: dev/src/index.ts:169
Type errors from the dev server's last type-check (typecheck: true in debuff.config), replaced on every check after a save. Empty when type-checking is off or the code type-checks.
Returns
wheel()
wheel(
dy,dx?):void
Defined in: dev/src/index.ts:123
Scroll the wheel by dy (and dx) CSS pixels this step: positive scrolls down / right.
Parameters
dy
number
dx?
number
Returns
void