Created
August 23, 2010 04:02
-
-
Save powdahound/544753 to your computer and use it in GitHub Desktop.
node.js model setup?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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