tomzx / gkm

⚠ Unsupported/Unmaintained ⚠️️ Global Keyboard and Mouse listener for node.js.
MIT License
52 stars 16 forks source link

event.data includes a newline #2

Closed FlorianWendelborn closed 8 years ago

FlorianWendelborn commented 8 years ago

(tested on Kubuntu 15) Awesome module, but unfortunately every event includes a newline in the data field.

index.js

var gkm = require('gkm');

gkm.events.on('key.pressed', function (data) {
    console.log('\'' + data + '\'')
    console.log(this.event + ' ' + data);
});

output

'D
'
key.pressed D

Guess that's not intended, makes it much harder to work with at least.

tomzx commented 8 years ago

@dodekeract, in gkm.js, could you try replacing the regex on line 13 from \r\n to \r\n|\r|\n and let me know if that fixes your issue?

FlorianWendelborn commented 8 years ago

Yeah, will verify that later today or tomorrow, will submit a pull-request if that fixes it.

tomzx commented 8 years ago

Closed per #3. Thanks again.