Mercurial > MadButterfly
comparison nodejs/mbapp.js @ 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 | 6133319d3fb4 |
comparison
equal
deleted
inserted
replaced
730:e77ae2d23245 | 731:1719484ed15d |
---|---|
41 app.prototype.dump=function() { | 41 app.prototype.dump=function() { |
42 sys.puts(this.onKeyPress); | 42 sys.puts(this.onKeyPress); |
43 } | 43 } |
44 | 44 |
45 app.prototype.addKeyListener=function(key,f) { | 45 app.prototype.addKeyListener=function(key,f) { |
46 this.keymap[key] = f; | 46 if (typeof(key) == 'number') |
47 this.keymap[key] = f; | |
48 else { | |
49 for(k in key) { | |
50 this.keymap[k] = f; | |
51 } | |
52 } | |
47 } | 53 } |
48 | 54 |
49 exports.app=app; | 55 exports.app=app; |
50 | 56 |
51 // Put all key definition here | 57 // Put all key definition here |