Skip to content

@caoergou/windows-xp / index / XPHandle

Interface: XPHandle

Defined in: src/components/XPBridge.tsx:153

Imperative handle exposed via ref on <WindowsXP/> (#76, extended in #115): lets the host drive the desktop programmatically (demos, tests, scenario scripting). The five original top-level methods are kept for backward compatibility; new capabilities are grouped by domain.

Properties

appearance

> appearance: XPAppearanceApi

Defined in: src/components/XPBridge.tsx:184

Appearance control.


cancelSchedule

> cancelSchedule: (id) => void

Defined in: src/components/XPBridge.tsx:210

Cancel a pending schedule by id (#130).

Parameters

id

string

Returns

void


clock

> clock: Pick&lt;XPClockApi, "now" | "set" | "advance" | "reset"&gt;

Defined in: src/components/XPBridge.tsx:190

Instance-local virtual system clock (#275).


closeWindow

> closeWindow: (id) => void

Defined in: src/components/XPBridge.tsx:174

Close a window by id.

Parameters

id

string

Returns

void


emit

> emit: (event) => void

Defined in: src/components/XPBridge.tsx:202

Inject an event onto the same bus onEvent and scenario triggers read.

Parameters

event

XPEvent

Returns

void


fs

> fs: XPFsApi

Defined in: src/components/XPBridge.tsx:180

Filesystem actuation.


getShareUrl

> getShareUrl: (windowId) => string | null

Defined in: src/components/XPBridge.tsx:172

Build a shareable permalink (?open=…) that reproduces windowId on a fresh load (#136). Returns null for component-only windows (no source path) or without a DOM.

Parameters

windowId

string

Returns

string | null


getSnapshot

> getSnapshot: () => XPSnapshot

Defined in: src/components/XPBridge.tsx:222

Capture the full desktop state as a portable, versioned snapshot (#117).

Returns

XPSnapshot


loadSnapshot

> loadSnapshot: (snapshot) => Promise&lt;void&gt;

Defined in: src/components/XPBridge.tsx:227

Replace this instance's state with a snapshot and reload to rehydrate. Throws XPSnapshotVersionError for a missing/too-new version.

Parameters

snapshot

XPSnapshot

Returns

Promise&lt;void&gt;


notify

> notify: (options) => string

Defined in: src/components/XPBridge.tsx:200

Pop an XP tray balloon notification (#118). Returns the notification id.

Parameters

options

NotifyOptions

Returns

string


openApp

> openApp: (appId, props?) => string | null

Defined in: src/components/XPBridge.tsx:155

Open a registered app by id, optionally passing component props.

Parameters

appId

string

props?

Record&lt;string, unknown&gt;

Returns

string | null


openExternal

> openExternal: (url, opts?) => void

Defined in: src/components/XPBridge.tsx:166

Follow a link out of the fiction to a real URL (#136). New tab by default; pass { newTab: false } to navigate the current tab. Emits link:external.

Parameters

url

string

opts?
newTab?

boolean

Returns

void


openFile

> openFile: (path) => string | null

Defined in: src/components/XPBridge.tsx:161

Open a filesystem node by absolute path (resolves the right app). This is a privileged host operation and does not show user password gates; use the desktop or Explorer when emulating user navigation.

Parameters

path

string[]

Returns

string | null


print

> print: object

Defined in: src/components/XPBridge.tsx:192

Data-driven virtual print spooler (#276).

addJob

> addJob: (job) => void

Parameters
job

Omit&lt;PrintJob, "submittedAt"&gt; & object

Returns

void

removeJob

> removeJob: (id) => void

Parameters
id

string

Returns

void

updateJob

> updateJob: (id, updates) => void

Parameters
id

string

updates

Partial&lt;PrintJob&gt;

Returns

void


qq

> qq: XPQQApi

Defined in: src/components/XPBridge.tsx:188

QQ Messenger actuation (#119).


reset

> reset: () => void

Defined in: src/components/XPBridge.tsx:178

Clear all persisted desktop state (localStorage + IndexedDB) and reload.

Returns

void


scenario

> scenario: XPScenarioApi

Defined in: src/components/XPBridge.tsx:220

Rehearsal / deterministic seek over the scenario's walkthrough (#207).


schedule

> schedule: (options) => string

Defined in: src/components/XPBridge.tsx:208

Schedule an event to fire after a delay or at a wall-clock deadline (#130). Pending schedules persist per instance and fire on next load if the deadline passed while the page was closed. Returns the schedule id.

Parameters

options

ScheduleOptions

Returns

string


session

> session: XPSessionApi

Defined in: src/components/XPBridge.tsx:182

Session control.


showAlert

> showAlert: (title, message) => void

Defined in: src/components/XPBridge.tsx:176

Show an XP dialog.

Parameters

title

string

message

string

Returns

void


sound

> sound: object

Defined in: src/components/XPBridge.tsx:198

Play a named XP system sound.

play

> play: (name) => void

Parameters
name

string

Returns

void


startLesson

> startLesson: (lessonId, mode?) => boolean

Defined in: src/components/XPBridge.tsx:216

Start a guided lesson by id (#141) in try (default), do, or watch mode. Returns false if no lesson with that id was registered via the lessons prop. Emits lesson:* events; progress persists per instance.

Parameters

lessonId

string

mode?

LessonMode

Returns

boolean


stopLesson

> stopLesson: () => void

Defined in: src/components/XPBridge.tsx:218

Stop the running lesson and clear its saved progress (#141).

Returns

void


windows

> windows: XPWindowsApi

Defined in: src/components/XPBridge.tsx:186

Window introspection + control.