Increase key emitter max listeners

This commit is contained in:
Mitchell McCaffrey 2021-08-05 14:51:07 +10:00
parent 9e2d09cafd
commit 4ca9353cd9

View File

@ -1,10 +1,13 @@
import React, { useEffect, useState, useContext } from "react";
import { EventEmitter } from "events";
const KeyboardContext = React.createContext({ keyEmitter: new EventEmitter() });
const keyboardEmitter = new EventEmitter();
keyboardEmitter.setMaxListeners(100);
const KeyboardContext = React.createContext({ keyEmitter: keyboardEmitter });
export function KeyboardProvider({ children }: { children: React.ReactNode }) {
const [keyEmitter] = useState(new EventEmitter());
const [keyEmitter] = useState(keyboardEmitter);
useEffect(() => {
function handleKeyDown(event: Event) {
// Ignore text input