Permalink
Browse files

Make asyncEJS work under latest node

  • Loading branch information...
1 parent 58b1dc8 commit 27d47955a2b340ff2a235d474b8e3580da0e50e6 Malte Ubl committed Jul 22, 2010
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/asyncEJS.js
View
16 lib/asyncEJS.js
@@ -135,11 +135,10 @@ TemplateEngine.prototype = {
}
};
-function load(filename, cb, errb) {
+function load(filename, cb, errcb) {
fs.readFile(filename, function (err, str) {
- if (err) throw err;
-
- var src = parseAndGenerate(str);
+ if (err) errcb(err);
+ var src = parseAndGenerate(str+"");
//sys.puts(src);
var fn = process.compile(src, filename);
@@ -158,8 +157,8 @@ function TemplateResponse(engine, filename) {
this.finished = false;
}
-process.inherits(TemplateResponse, process.EventEmitter);
-process.mixin(TemplateResponse.prototype, {
+sys.inherits(TemplateResponse, process.EventEmitter);
+var body = {
print: function () {
this.p.push.apply(this.p, arguments);
},
@@ -227,7 +226,10 @@ process.mixin(TemplateResponse.prototype, {
}
return i;
}
-});
+};
+for(var i in body) {
+ TemplateResponse.prototype[i] = body[i];
+};
function parseAndGenerate(str) {
var open = "<%";

0 comments on commit 27d4795

Please sign in to comment.