That's an interesting opinion, and I suggest you read more of this mailing
list archives because this has been brought up many times with always the
same answer.
It is the CommonJS way, which node.js has adopted early on. It is therefore
also the node.js way.
If the OP wants his module to work in the 5 next minutes, he only needs to
know this :
function myConstructor() {
}
module.exports = myConstructor
further reading here http://nodejs.org/api/modules.html
On Wednesday, 27 November 2013 01:36:41 UTC+1, Reza Razavipour wrote:
>
> so I am trying to export a class constructor... This is what I have done
> based on my readings.
>
> define('SystemVersionResponse', function() {
>
>
>
> function SystemVersionResponse(input) {
>
> this.errorMessage = String.fromCharCode.apply(String,
> input.rsp.rsp.errorMessage.item).replace(/\0/g,'');
>
> this.errorNumber = input.rsp.rsp.errorMessage.errorNumber;
>
> }
>
>
> SystemVersionResponse.prototype.getErrorCode = function() {
>
> return errorNumber;
>
> };
>
>
> SystemVersionResponse.prototype.getErrorMessage = function() {
>
> return errorMessage;
>
> };
>
>
> SystemVersionResponse.prototype.getRevision = function() {
>
> return revision;
>
> };
>
> return SystemVersionResponse;
>
> });
>
> I get the syntax error:
>
> ReferenceError: define is not defined
>
> What package am I missing?
>
>
> Is this the correct way to export a constructor?
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.