-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Background
JSAR Runtime currently lacks a unified input event management system and does not support DOM Keyboard Events such as keydown and keyup. For extensibility and cross-platform compatibility, input event capture should be abstracted away from the core runtime and handled by the integrating application.
Proposal
- InputManager Module
- Add a new module in
src/runtime(e.g.src/runtime/input-manager) responsible for managing input events (keyboard, mouse, etc.). - InputManager should NOT directly listen to system events. Instead, it provides an interface for the host/integrated application to forward input events to JSAR Runtime. This allows different platforms (Unity, Unreal, native, etc.) to implement their own input event listeners and inject events into JSAR.
- InputManager receives input events (e.g. keyboard) from the host application and broadcasts them through the existing IPC mechanism to the correct JSAR application instance.
- On the client side, these events are mapped to standard DOM events (such as
KeyboardEvent) and dispatched to the appropriate DOM nodes.
- Add a new module in
- KeyboardEvent API
- Implement standard DOM
KeyboardEventsupport on the client side, including bubbling, capture, and cancellation (preventDefault). - Ensure compatibility with
addEventListenerand related DOM APIs.
- Implement standard DOM
Benefits
- Clean separation between event capture and event management, increasing portability and modularity.
- Enables robust keyboard input support, improving accessibility and usability for JSAR-powered apps.
- Host applications retain control over platform-specific input integration.
References
- MDN KeyboardEvent
- Input event handling in game engines (Unity, Unreal, etc.)
Acceptance Criteria
- InputManager module exists in
src/runtimeand exposes APIs for host applications to inject input events. - Keyboard events are correctly dispatched from InputManager to client DOM as standard events.
- Example/demo provided for host-side event injection and DOM event handling.
- Integration guide/documentation updated to describe platform-specific input event forwarding.
Copilot
Metadata
Metadata
Assignees
Labels
No labels