Mercurial > MadButterfly
diff nodejs/testcase.js @ 679:799c852b9065
Extract event info from C object to JS object
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 06 Aug 2010 19:31:37 +0800 |
parents | f264b50c469c |
children | a588eefd3f04 |
line wrap: on
line diff
--- a/nodejs/testcase.js Fri Aug 06 19:30:52 2010 +0800 +++ b/nodejs/testcase.js Fri Aug 06 19:31:37 2010 +0800 @@ -55,6 +55,13 @@ sys.puts(root.subject); var observer; /* Mouse button pressed */ -observer = root.subject.add_event_observer(4, function() { - sys.puts("mouse"); +observer = root.subject.add_event_observer(4, function(evt) { + sys.puts("mouse " + evt.x + " " + evt.y); }); + +var kbobserver; +/* Keyboard event */ +kbobserver = mb_rt.kbevent.add_event_observer(6, function(evt) { + sys.puts("keycode = " + evt.keycode); + sys.puts("sym = " + evt.sym); + });