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

Keypresses #36

Open
gxthmxm opened this issue Nov 5, 2017 · 0 comments
Open

Keypresses #36

gxthmxm opened this issue Nov 5, 2017 · 0 comments

Comments

@gxthmxm
Copy link

gxthmxm commented Nov 5, 2017

ezpz

This is the code I used function sendKey (code) {
var down = new Event('keydown');
down.keyCode = code;
document.dispatchEvent(down);
var press = new Event('keypress');
press.keyCode = code;
document.dispatchEvent(press);
setTimeout(function () {
var up = new Event('keyup');
up.keyCode = code;
document.dispatchEvent(up);
}, 1);
}

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

1 participant