Skip to content

Instantly share code, notes, and snippets.

@powdahound
Created August 23, 2010 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save powdahound/544753 to your computer and use it in GitHub Desktop.
Save powdahound/544753 to your computer and use it in GitHub Desktop.
node.js model setup?
var task = require('./task');
var t1 = new(task.Task)("Blah");
var t2 = new(task.Task)("Foo");
sys.puts(t1.getBody());
sys.puts(t2.getBody());
var tasks = task.getTasks();
sys.puts(sys.inspect(tasks));
exports.Task = function(body) {
this.body = body;
};
exports.Task.prototype.getBody = function() {
return this.body;
};
// Static fetch function
exports.getTasks = function() {
var tasks = [];
tasks.push(new this.Task('getTasks 1'));
tasks.push(new this.Task('getTasks 2'));
return tasks;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment