Docs
Do it for me
Perform mode: clicks, typing, hand-offs.
In Do it for me the guide really clicks, types, presses keys and hovers. The same trace plays as Show me with mode: 'overlay'.
{
"version": 1,
"meta": { "title": "Start a task", "requires": ["signed-in"] },
"steps": [
{ "type": "click", "page": "/app", "target": { "role": "link", "name": "New task" } },
{ "type": "type", "page": "/app/tasks/new", "target": { "role": "textbox", "name": "Objective" }, "text": "Check prices" },
{ "type": "type", "target": { "role": "textbox", "name": "Budget code" }, "text": "•••", "mask": true },
{ "type": "click", "target": { "role": "button", "name": "Start task" }, "checkpoint": true },
{ "type": "wait", "page": "/app", "target": { "sel": "#status" }, "until": { "text": "Running" }, "say": "Starting…" }
]
}import { createTrace } from 'trace-avatar/perform'; // CDN: trace-perform.min.js
createTrace({ trace, autoplay: true, navigate: (path) => router.push(path), prepare: () => isSignedIn() });How it acts
- Inputs: values are set the way React, Vue and Svelte notice (native setter, then input); a select picks the option whose text you typed; rich-text editors get insertText; Enter in a form field submits the form.
- Masked fields (passwords, anything the recorder masked): the guide stops, focuses the field, says “Your turn: type in “Password”, then press play” and emits
handoff. It never knows the text. - The viewer steps in: real input pauses the guide. When they press play, it goes on from the next step marked
checkpoint: true. It never seeks backwards; restart starts over. - What it can’t do: browsers ignore synthetic events for file pickers, fullscreen, the clipboard, payment and other cross-origin iframes. Put a hand-off (pause: true with a say) there.
Hooks
| Option | |
|---|---|
prepare(requires, trace) | Runs before every start. Return true, or false / { ok: false, say } to show the message and stay put (blocked event); play tries again. |
onReset() | Put the app back before a restart. |
resumeKey | Carry on after a full page load (within 10 minutes). |
performer | The hands, for the main entry, React or the custom element: performer: createPerformer. |
meta.requires (e.g. ["signed-in"]) tells prepare what the guide needs. In React pass onHandoff / onBlocked; on the custom element listen for trace-handoff / trace-blocked.
The full reference is in the README on GitHub.