Thanks for all the suggestions. I tried detecting which environment I was
in but it didn't work.
We have built a couple of singleplayer games and built our own framework
for this using the Google Closure library and compiler, so this would have
to be supported too.
I tried doing the following:
(function() {
if (goog) {
//Client
goog.provide('multigame.model.Ball');
} else {
//Server
multigame = { model: {} };
module.exports = multigame.model;
}
})();
/**
* @constructor
*/
multigame.model.Ball = function(x, y, r) {
this.x = x;
this.y = y;
this.r = r;
};
This works fine with the Closure compiler, but Node breaks with a
'ReferenceError: goog is not defined'.
If I check against 'module' and 'module.exports' then Node works but the
Closure compiler breaks with 'ERROR - variable module is undeclared'
So...how do I check wheter or not something that might not be defined is
defined without getting errors ?
Will I really have to translate the code in order to compile/run it ?
--
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