How to pass info from one extension to another

Hi ,
I’ve created an extension that keeps track of if any (shift in th is case) key is pressed :

 EditorView.domEventHandlers({
                        keydown( event,view) {
                          if (event.key === "Shift") {
                            console.log("shift Pressed")
                            return false;
                          }
                        },
                        // Set the flag to false when the shift key is released
                        keyup(event,view) {
                          if (event.key === "Shift") {
                            console.log("shift released")
                            return false;
                          }
                        }
                      }),

How may I pass this info into another extension? Can some one help with an example ?

Use a ViewPlugin rather than a plain domEventHandlers extension to store the key state, and then use view.plugin(myPlugin) to read its value.