A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
695 B
31 lines
695 B
const keypress = (opts) => { |
|
let event = new KeyboardEvent('keypress', { |
|
key: opts.key, |
|
altKey: opts.altKey, |
|
shiftKey: opts.shiftKey, |
|
ctrlKey: opts.ctrlKey |
|
}); |
|
document.body.dispatchEvent(event); |
|
}; |
|
|
|
const keydown = (opts) => { |
|
let event = new KeyboardEvent('keydown', { |
|
key: opts.key, |
|
altKey: opts.altKey, |
|
shiftKey: opts.shiftKey, |
|
ctrlKey: opts.ctrlKey |
|
}); |
|
document.body.dispatchEvent(event); |
|
}; |
|
|
|
const keyup = (opts) => { |
|
let event = new KeyboardEvent('keyup', { |
|
key: opts.key, |
|
altKey: opts.altKey, |
|
shiftKey: opts.shiftKey, |
|
ctrlKey: opts.ctrlKey |
|
}); |
|
document.body.dispatchEvent(event); |
|
}; |
|
|
|
export { keypress, keydown, keyup };
|
|
|