The embedded Infinite Mac emulator supports two-way communication with the parent page through the browser’s standardDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mihaip/infinite-mac/llms.txt
Use this file to discover all available pages before exploring further.
window.postMessage API. You can send control commands to the emulator (pause, keyboard/mouse input, disk loading) and listen for status notifications (boot complete, screen updates).
The full TypeScript definitions for both directions live in src/embed-types.ts.
Basic Send / Receive Pattern
Sending Messages — EmbedControlEvent
emulator_pause
Pause the emulator. Useful for reducing CPU and GPU usage when the user is not actively interacting with the embed. See also the paused and auto_pause URL parameters for automatic pause behaviour.
emulator_unpause
Resume a paused emulator.
emulator_mouse_move
Send a mouse movement event. The coordinate semantics depend on the underlying emulator:
- Absolute coordinates (
x,y) — supported by Mini vMac, Basilisk II, SheepShaver, and Snow. - Relative coordinates (
deltaX,deltaY) — used by Previous, DingusPPC, and PearPC.
emulator_mouse_down / emulator_mouse_up
Send a mouse button press or release. button follows the same numbering as MouseEvent.button: 0 = left, 1 = middle, 2 = right.
Right-click (button: 2) is only supported by certain emulator and OS combinations — specifically Previous, and DingusPPC running Mac OS X.
emulator_key_down / emulator_key_up
Send a physical key press or release. The code property uses the same values as the KeyboardEvent.code property — for example "KeyA", "ArrowLeft", "MetaLeft", "Enter".
See
src/emulator/common/key-codes.ts
for the full list of key codes recognised by the emulator.emulator_load_disk
Load a disk image from a URL into the running emulator. The url must point to an uncompressed disk image file (.dsk, .img, .iso, .toast, etc.).
Supported emulators: Mini vMac, Basilisk II, SheepShaver, Previous, and Snow (machines with a SCSI bus). Not supported by DingusPPC or PearPC.
Receiving Messages — EmbedNotificationEvent
emulator_loaded
Fired once when the emulator has finished loading all of its data files and the emulated machine has begun running. This is the earliest point at which it is safe to send input events.
emulator_screen
Fired on every frame when the screen contents change. The data field is a Uint8ClampedArray containing raw pixel data in RGBA format (4 bytes per pixel, row-major order). width and height give the dimensions of the frame.
Complete Working Example
The page below embeds a System 7.1 Quadra 650, logs a message when the machine finishes booting, and automatically pauses the emulator after 5 seconds.Create the iframe
Point the
src at the /embed endpoint with your chosen disk, machine, and
screen size parameters.Listen for emulator_loaded
Attach a
message listener on window and branch on event.data.type.
Wait for emulator_loaded before sending any input commands.