You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

browser-forward-keyboard-listener

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-forward-keyboard-listener - npm Package Compare versions

Comparing version

to
1.1.0

src/keys.ts

2

package.json
{
"name": "browser-forward-keyboard-listener",
"description": "capture mouse and keyboard event from browser and send them back via WS",
"version": "1.0.9",
"version": "1.1.0",
"private": false,

@@ -6,0 +6,0 @@ "main": "dist/index.js",

@@ -40,4 +40,7 @@ // Create WebSocket connection.

const handleKeyDown = (key:string) => {
// prevent this event to keep firing when the key is held down
if(activeKeys.has(key)) return;
activeKeys.add(key);
socket.send(JSON.stringify({type:'keyDown', key}));

@@ -61,3 +64,3 @@ };

e.preventDefault();
handleKeyDown(e.key.toLowerCase());
handleKeyDown(e.code);
});

@@ -67,3 +70,3 @@

e.preventDefault();
handleKeyUp(e.key.toLowerCase());
handleKeyUp(e.code);
});

@@ -73,7 +76,7 @@

e.preventDefault();
handleKeyDown("mouse"+e.button);
handleKeyDown("Mouse"+e.button);
});
document.addEventListener('mouseup', function(e) {
e.preventDefault();
handleKeyUp("mouse"+e.button);
handleKeyUp("Mouse"+e.button);
});

@@ -80,0 +83,0 @@ document.addEventListener('contextmenu',(e)=>e.preventDefault());

@@ -5,3 +5,5 @@ import {createServer} from "./server";

export * from "./KeyListenersManager";
export * from "./keys";
// open the browser and start listening to user input
export function initKeyboardListener() {

@@ -8,0 +10,0 @@ const port = process.env.PORT || 3000;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet