I am working on a mid-size application in Javascript. I would like to create a switcher, similar to the OS window switcher. When a UI part becomes active, it should mute all event listeners from other UI parts and give the active UI an exclusive access to the keyboard and mouse input. For example ctrl+c
on an active panel would copy panel data, while ctrl+c
on an active canvas would copy a selected shape. Both panel and canvas are contained within a single view.
One way to implement it is to utilize observer pattern giving one observer an exclusive access to mute other observers (the switcher), this would prevent unwanted observers from interfering with the keyboard and mouse input.
This is however an experimental solution, what are the current ways to implement this functionality?
Aucun commentaire:
Enregistrer un commentaire