mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: migrate keyboard.js to typescript (#2160)
Signed-off-by: Abdulrehman-Jafer <abdulrehmanjaferwork01233@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5392582819
commit
f5be8a0c86
@@ -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);
|
||||
// });
|
||||
Reference in New Issue
Block a user