Mercurial > MadButterfly
changeset 731:1719484ed15d
Make the argument key can be an array to register multiple keys.
author | wycc |
---|---|
date | Fri, 20 Aug 2010 07:25:59 +0800 |
parents | e77ae2d23245 |
children | 6879aa403306 |
files | nodejs/mbapp.js |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/mbapp.js Fri Aug 20 07:21:24 2010 +0800 +++ b/nodejs/mbapp.js Fri Aug 20 07:25:59 2010 +0800 @@ -43,7 +43,13 @@ } app.prototype.addKeyListener=function(key,f) { - this.keymap[key] = f; + if (typeof(key) == 'number') + this.keymap[key] = f; + else { + for(k in key) { + this.keymap[k] = f; + } + } } exports.app=app;