function useKeypress(
  code,
  callback, 
  {
    shift = false,
    ctrl = false,
    alt = false,
    repeat = false
  } = {}
) {
  useEffect(() => {
    let key = getKey(code, shift, ctrl, alt);
    callback.repeat = repeat;
    listeners[key] = callback;
    return () => delete listeners[key];
  }, [code, callback, shift, ctrl, alt, repeat]);
}
// TODO: there's a flaw in that this can't handle multiple callbacks for the same key
there's a flaw in that this can't handle multiple callbacks for the same key
there ' s a flaw in that this can ' t handle multiple callbacks for the same key
function useKeypress(
  code,
  callback, 
  {
    shift = false,
    ctrl = false,
    alt = false,
    repeat = false
  } = {}
) {
  useEffect(() => {
    let key = getKey(code, shift, ctrl, alt);
    callback.repeat = repeat;
    listeners[key] = callback;
    return () => delete listeners[key];
  }, [code, callback, shift, ctrl, alt, repeat]);
}
function useKeypress ( code , callback , { shift = false , ctrl = false , alt = false , repeat = false } = { } ) { useEffect ( ( ) => { let key = getKey ( code , shift , ctrl , alt ) ; callback . repeat = repeat ; listeners [ key ] = callback ; return ( ) => delete listeners [ key ] ; } , [ code , callback , shift , ctrl , alt , repeat ] ) ; }
TODO: there's a flaw in that this can't handle multiple callbacks for the same key
TODO : there ' s a flaw in that this can ' t handle multiple callbacks for the same key