Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Possible API Enhancements #1

@Rami-Sabbagh

Description

@Rami-Sabbagh
  1. Device objects cache: Cache devices objects by device id, so when a device object is requested for the same id, the same reference for an existing one would be returned. This could remove some stress on the garbage collector, and should be possible to be done using WeakMap and maybe Symbol too.
  2. Events pattern: The interception class can be an events emitter, emitting events like:
    • device: After a wait() call.
    • mouse: When the device is a mouse.
    • keyboard: When the device is a keyboard.
    • stroke: When the stroke is received.
    • mouse_stroke: When a mouse stroke is received.
    • key_stroke: When a keyboard stroke is received.
    • mouse_down: When a mouse button is down.
    • mouse_up: When a mouse button is up.
    • mouse_scroll: When a mouse wheel is scrolled.
    • mouse_move: When the mouse moves.
    • key_down: When a key is pressed down.
    • key_up: When a key is released.
    • key_e0: When a special key is pressed down.
    • key_e1: When a special key is released.
  3. Events: Events objects like the DOM ones can be used, with the preventDefault functionality for blocking the whole event and such.
  4. Construction Options: With the events system, it would be nice to have the events filters automatically setup at initialization. It would also be good to add an option for automatically translating e0 and e1 key strokes to up and down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions