aboutsummaryrefslogblamecommitdiff
path: root/e2e/ambassador/src/client/keys.js
blob: 6b36c23b144cd07e7b32307f770263505acb0351 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                                                

                                                                             
                                 
                         
            
  
                                                             
                              
                        
            

  
                                                           
                              
                      
            

                           
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 };