# HG changeset patch # User wycc # Date 1282260359 -28800 # Node ID 1719484ed15d991b8cc450c95333bc37aea814d5 # Parent e77ae2d232459df5916f53cc51ae23e38f0c4009 Make the argument key can be an array to register multiple keys. diff -r e77ae2d23245 -r 1719484ed15d nodejs/mbapp.js --- 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;