web: migrate keyboard.js to typescript (#2160)

Signed-off-by: Abdulrehman-Jafer <abdulrehmanjaferwork01233@gmail.com>
This commit is contained in:
Abdulrehman-Jafer
2023-03-24 00:57:55 +05:00
committed by GitHub
parent 5392582819
commit f5be8a0c86

View File

@@ -19,17 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import EventManager from "@notesnook/core/utils/event-manager";
const GlobalKeyboard = {};
const KeyboardEventManager = new EventManager();
GlobalKeyboard.addEventListener = (name, handler) => {
KeyboardEventManager.subscribe(name, handler);
const GlobalKeyboard = {
addEventListener: (name: string, handler: (...args: any[]) => void) => {
KeyboardEventManager.subscribe(name, handler);
},
removeEventListener: (name: string, handler: (...args: any[]) => void) =>
KeyboardEventManager.unsubscribe(name, handler)
};
GlobalKeyboard.removeEventListener = (name, handler) =>
KeyboardEventManager.unsubscribe(name, handler);
// window.addEventListener("keydown", (e) => {
// // KeyboardEventManager.publish("keydown", e);
// });