Skip to content

Add InputManager module and IPC-driven KeyboardEvent support (host-driven input injection) #209

@yorkie

Description

@yorkie

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.
  • KeyboardEvent API
    • Implement standard DOM KeyboardEvent support on the client side, including bubbling, capture, and cancellation (preventDefault).
    • Ensure compatibility with addEventListener and related DOM APIs.

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

Acceptance Criteria

  • InputManager module exists in src/runtime and 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions