View Full Version : Add keyup event to body?

1 Feb 2012, 9:36 AM
In Ext JS you can add DOM element events using component.mon(). I don't see mon() is the Touch API. What I want to do is listen for ctrl-L key event on the body. Is this possible using the Touch API? I believe I can do this using straight JavaScript but always prefer using the API over that.

1 Feb 2012, 9:42 AM
You only need on() on an element or component now, not mon(). The issue is ST is geared towards mobile devices which don't have a keyboard open unless on a form field.

1 Feb 2012, 11:53 AM
This is actually a Kiosk project that runs in Chrome. We want a ctrl-L from a real keyboard to bring up a console in the app to help troubleshoot devices. I'll see if I can get something to work.

1 Feb 2012, 11:55 AM
Then that will require just native JS

1 Feb 2012, 2:09 PM
Ended up being easy. Though scope would be a pain but wasn't.

var me = this,
body = Ext.getBody();

body.dom.addEventListener('keyup', function(event) {
}, true);