c4milo/node-libvirt — pull request #34 by atoy40 (2014-05-06 09:38:38+00:00)
Title: Added libvirt event support using libuv

Hello,

this is the implementation and registration of libvirt event handler. I Didn't test it a lot .. but it works for the simple cases i've tested.
Here is a very small code example, not the setupEvent() call, it registers event callbacks into libvirt :

var libvirt = require('libvirt');
libvirt.setupEvent();

var hv = new libvirt.Hypervisor('qemu:///system');

hv.registerDomainEvent({
evtype: 0,
callback: function(hv, domain, data) {
console.log("state change " + domain.getName() + " " + data.evtype + " " + data.detail);
}
});