Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

name/rawKey is undefined #39

Closed
matvejs16 opened this issue Apr 5, 2024 · 7 comments
Closed

name/rawKey is undefined #39

matvejs16 opened this issue Apr 5, 2024 · 7 comments

Comments

@matvejs16
Copy link

Problem:

Module is not sending vKey, rawKey, name parameters in event argument

Code:

import { GlobalKeyboardListener } from 'node-global-key-listener'
const kb = new GlobalKeyboardListener()

kb.addListener((e, down) => {
    console.log(e, down)
})

Output:

{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 85,
  _raw: 'KEYBOARD,DOWN,85,22,0,0,305'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 85,
  _raw: 'KEYBOARD,UP,85,22,0,0,306'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 78,
  _raw: 'KEYBOARD,DOWN,78,49,0,0,307'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 78,
  _raw: 'KEYBOARD,UP,78,49,0,0,308'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 68,
  _raw: 'KEYBOARD,DOWN,68,32,0,0,309'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 69,
  _raw: 'KEYBOARD,DOWN,69,18,0,0,310'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 68,
  _raw: 'KEYBOARD,UP,68,32,0,0,311'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 69,
  _raw: 'KEYBOARD,UP,69,18,0,0,312'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 70,
  _raw: 'KEYBOARD,DOWN,70,33,0,0,313'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 70,
  _raw: 'KEYBOARD,UP,70,33,0,0,314'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 73,
  _raw: 'KEYBOARD,DOWN,73,23,0,0,315'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 73,
  _raw: 'KEYBOARD,UP,73,23,0,0,316'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 78,
  _raw: 'KEYBOARD,DOWN,78,49,0,0,317'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 78,
  _raw: 'KEYBOARD,UP,78,49,0,0,318'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 69,
  _raw: 'KEYBOARD,DOWN,69,18,0,0,319'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 69,
  _raw: 'KEYBOARD,UP,69,18,0,0,320'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 68,
  _raw: 'KEYBOARD,DOWN,68,32,0,0,321'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 68,
  _raw: 'KEYBOARD,UP,68,32,0,0,322'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 32,
  _raw: 'KEYBOARD,DOWN,32,57,0,0,323'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 32,
  _raw: 'KEYBOARD,UP,32,57,0,0,324'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 8,
  _raw: 'KEYBOARD,DOWN,8,14,0,0,325'
} { undefined: true }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'UP',
  scanCode: 8,
  _raw: 'KEYBOARD,UP,8,14,0,0,326'
} { undefined: false }
{
  vKey: NaN,
  rawKey: undefined,
  name: undefined,
  state: 'DOWN',
  scanCode: 1,
  _raw: 'MOUSE,DOWN,1,1,441,694,327'
} { undefined: true }
@TarVK
Copy link
Member

TarVK commented Apr 5, 2024

Hey matvejs16, could you let us know what OS you are running this on exactly?

@Senails
Copy link

Senails commented Apr 5, 2024

win 11, the same mistake
image

@matvejs16
Copy link
Author

Hey matvejs16, could you let us know what OS you are running this on exactly?

Windows 11 (23H2) ver. 22631.3296

@xueqino1
Copy link

xueqino1 commented Apr 21, 2024

in the function " _getEventData(data) ", the data is "KEYBOARD,UP,13,28,0,0,1", the variable vkey obtains "KEYBOARD" as its value, so it can't get the right info. you can try changing arr[0] to arr[2].

@sancarn
Copy link
Contributor

sancarn commented Apr 21, 2024

Hi everyone, I assume this was broken as of #31 Unfortunately I didn't really test it as thoroughly as I should have. Imagine it should be relatively easy to fix, but haven't had any time to do so yet. If anyone wants to fix and submit a PR that'd be great :) If not, in the interim you can likely use a previous version of the npm package.

@mucolee
Copy link

mucolee commented Apr 30, 2024

image
image
视乎有点问题

@sancarn
Copy link
Contributor

sancarn commented May 18, 2024

Hi all, this should be fixed in the latest version :)

@sancarn sancarn closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants