Access what keyboard and mouse actions are occuring gloabally using node.js

Is there a library or module or some sort of work around I can use with node.js so that I can see what keys are being pressed, when the mouse is clicked, where the mouse clicks, as well as what application has current focus? This is for an application I wan to write to track my own time similar to what Whatpulse does, however with more functionality and features. I also want to be able to do it on windows and osx.