|
|
@ -4,28 +4,25 @@ import * as ipc from './ipc'; |
|
|
|
const NEUTRAL_MODIFIERS = { shiftKey: false, altKey: false, ctrlKey: false }; |
|
|
|
const NEUTRAL_MODIFIERS = { shiftKey: false, altKey: false, ctrlKey: false }; |
|
|
|
|
|
|
|
|
|
|
|
const press = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { |
|
|
|
const press = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { |
|
|
|
return ipc.send(Object.assign({}, modifiers, { |
|
|
|
return ipc.send({ ...modifiers, |
|
|
|
type: EVENT_KEYPRESS, |
|
|
|
type: EVENT_KEYPRESS, |
|
|
|
tabId, |
|
|
|
tabId, |
|
|
|
key, |
|
|
|
key, }); |
|
|
|
})); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const down = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { |
|
|
|
const down = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { |
|
|
|
return ipc.send(Object.assign({}, modifiers, { |
|
|
|
return ipc.send({ modifiers, |
|
|
|
type: EVENT_KEYDOWN, |
|
|
|
type: EVENT_KEYDOWN, |
|
|
|
tabId, |
|
|
|
tabId, |
|
|
|
key, |
|
|
|
key, }); |
|
|
|
})); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const up = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { |
|
|
|
const up = (tabId, key, modifiers = NEUTRAL_MODIFIERS) => { |
|
|
|
return ipc.send(Object.assign({}, modifiers, { |
|
|
|
return ipc.send({ modifiers, |
|
|
|
type: EVENT_KEYUP, |
|
|
|
type: EVENT_KEYUP, |
|
|
|
tabId, |
|
|
|
tabId, |
|
|
|
key, |
|
|
|
key, }); |
|
|
|
})); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export { press, down, up }; |
|
|
|
export { press, down, up }; |
|
|
|