Is there a way to listen for key press events like...
# compose
j
Is there a way to listen for key press events like CTRL hold and etc in js/wasm ? I know in desktop I can on the window object … is the only way in wasm/js in the document object as well ? Nothing platform independent ?
a
you can always use the
Modifier.onKeyEvent{}
modifier on your top level composable
j
It only works if the component is focused but yeah it makes sense if I put it in the main column it might work will try it ( I feel like I am an idiot ) ;;):) started compose multi platform not long ago and skipped the jetpack which is not great I guess
a
it's cool man. it will be slow at first to get used to the simplicity of Compose depending on your background but it will stick eventually different platforms/targets have different characteristics. ie on desktop you can have multiple windows, but on browser you have only one.
j
Yeah I am building a web/desktop app so trying to be independent and on the web I am trying to use both js ir and wasm since wasm is yet to be working on mobile browsers