I connected a button to the Raspberry Pi GPIO ports:
The pi-gpio node
I just came accross this modulle
https://github.com/EnotionZ/GpiO
I have not looked in depth to it but is seems it uses the setInterval method in the background.