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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
import { EVENT_KEYPRESS, EVENT_KEYDOWN, EVENT_KEYUP } from '../shared/messages';
|
|
|
|
import * as ipc from './ipc';
|
|
|
|
|
|
|
|
const NEUTRAL_MODIFIERS = { shiftKey: false, altKey: false, ctrlKey: false };
|
|
|
|
|
|
|
|
const press = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => {
|
|
|
|
return ipc.send({ ...modifiers,
|
|
|
|
type: EVENT_KEYPRESS,
|
|
|
|
tabId,
|
|
|
|
key, });
|
|
|
|
};
|
|
|
|
|
|
|
|
const down = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => {
|
|
|
|
return ipc.send({ modifiers,
|
|
|
|
type: EVENT_KEYDOWN,
|
|
|
|
tabId,
|
|
|
|
key, });
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const up = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => {
|
|
|
|
return ipc.send({ modifiers,
|
|
|
|
type: EVENT_KEYUP,
|
|
|
|
tabId,
|
|
|
|
key, });
|
|
|
|
};
|
|
|
|
|
|
|
|
export { press, down, up };
|