In recent versions of Node.js, the native EventEmitter class is pure Javascript. So you'll have to instanciate it from the JS constructor.
Anyway, if the library you're writing bindings to is C, you should just do the smallest work in C and do the rest in JS.
see this example from node-libspotify
https://github.com/Floby/node-libspotify/blob/master/lib/Player.jsOn Wednesday, 31 July 2013 01:22:30 UTC+2, kevzettler wrote:
Hi i'm writing a node wrapper for a C level library. I'd like to structure the the Node API as a standard node event emitter something like c_lib.on("event", callback) Wondering if anyone has experience doing this and maybe an example I can eyeball. So far all i've found as far as examples are one time async callback addons like c_lib.method(callbache k(){}).