Jump to content

node js problems

- - - - -

  • Please log in to reply
No replies to this topic

#1
mattigit

mattigit

    Newbie

  • Members
  • Pip
  • 1 posts
regarding defining objects in modules.

lets say i have a module:


/*---obj----*/
a = require('net');
function A (socket){
this.socket=socket;

}
A.prototype.func=function(){ this.socket.write('ddfdf');}

exports.func=func;

/*---file.js----*/
obj=require('obj');

function fileFunc(A){
A.func();
}

the socket is from the module type net
for some reason when i invoke the function A.function it goes into the function but throws in error claiming that "cannot call method 'write' of undefiend

does any one know why?

thanx




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users