Ionic/Angular 9 Alert service pass KeyCode (key function mapping) to component?

so I'm using an ionic alert service so I can call this service and create alerts from any component within my app. Now, on the alert, I have YES and NO buttons. I was able to add an event listener to the ESC key, so if the user presses ESC or clicks on the NO option, then the alert closes. Now, I need to do the same for the F3 key, so if the user presses on F3 on their keyboard, it would behave as if they clicked on yes. From my Alert service, I'm not assigning any function to the YES role, so the handler just returns empty. I set the function to the YES option on each component so I'm not able to tell what the F3 will do because they function changes depending on the component that calls the service. I have a map with keys from F1-F12 keys, then I was trying to use an event emitter and subscribe to that but it didn't work, then I tried using KeyCodes and I had no luck because I can't get the function for the YES role.

There are no answers yet.
Be the first to answer this question.