Closed ch3rn1k closed 1 year ago
if you mean pressing a key outside of keysender - it's not possible, winapi doesn't have methods for that
if you mean pressing a key outside of keysender - it's not possible, winapi doesn't have methods for that
I mean to make a wait function, you already have GlobalHotkey
that detects key press
Like await obj.keyboard.waitKey("a");
in 2.1.0 the LowLevelHook
class was added with which this logic can be implemented
in 2.1.0 the
LowLevelHook
class was added with which this logic can be implemented
Nice one, thanks, but is there a way to use async/await
with LowLevelHook.on()
?
Like await LowLevelHook.on('keyboard', 'a', true)
no, it works like addEventListener in browser
well, still awesome lib, hope you will implement async/await
later
but you can write something like whis
const waitForKey = (device, button, state) =>
new Promise((resolve) => {
const unlisten = LowLevelHook.on(device, button, state, () => {
unlisten();
resolve();
});
});
but you can write something like whis
const waitForKey = (device, button, state) => new Promise((resolve) => { const unlisten = LowLevelHook.on(device, button, state, () => { unlisten(); resolve(); }); });
Looks like after unlistening next time .on
ain't works
thats what unlisten do
thats what unlisten do
I mean another call in new function with waitForKey
ain't works. I can only 1 single time call waitForKey
in a code. Until i reload my script .on
will not call again. It's not reusable :(
If we talking about addEventListener
it can be added and removed. In another function I can call addEventListener
again and it will work
After calling LowLevelHook.deleteAll();
it can be called again
should be fixed in 2.1.1
should be fixed in 2.1.1
Thanks
Is there a way to listen keys combination?
["ctrl", "e"]
no, but you can do it by yourself
Hey ya, any way to add a function like to wait for a key press? Smth like
waitKey
,waitClick
,waitMove
,waitScroll
Dat will be awesome <3