I am implementing a JavaScript library that can also run on node, and I’d like to use node’s API as much as possible. My objects emit events, so I found this nice library called eventemitter2, and which reimplements EventEmitter for JavaScript. Now I’d like to find the same for util.inherits. Has anybody heard about such a project ?
Share
Have you tried using the Node.js implementation? (It uses
Object.create, so it may or may not work on the browsers you care about). Here’s the implementation, from https://github.com/joyent/node/blob/master/lib/util.js:Another method is used by CoffeeScript, which compiles
to