From 13cbffc0f1d26644ab9ca65bb214afcd03ea2413 Mon Sep 17 00:00:00 2001 From: kailash Date: Mon, 2 May 2011 22:07:37 +0530 Subject: [PATCH] using sys.inherits for prototypal inheritance --- isbn.js | 7 ++++--- test.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/isbn.js b/isbn.js index fec2e1a..5e55c06 100644 --- a/isbn.js +++ b/isbn.js @@ -1,5 +1,6 @@ -var http = require('http'); -var emitter = require('events').EventEmitter; +var http = require('http'), + emitter = require('events').EventEmitter, + inherits = require('sys').inherits; var options = { host : 'isbn.net.in', path : '/' } @@ -108,7 +109,7 @@ function lookup(isbn) }).on('error', function(e) { $.emit('error', new error(-1, e)); }); } -lookup.prototype = new emitter; +inherits(lookup, emitter); lookup.prototype.__parse = parse; function search(isbn) diff --git a/test.js b/test.js index 16d7156..36e94d9 100644 --- a/test.js +++ b/test.js @@ -1,6 +1,6 @@ var isbn = require('./isbn'); -isbn.lookup('142000280').on('err', +isbn.lookup('0142000280').on('err', function(err) { console.log("ERROR :", err); }).on('success',