Browse Source

test server using async toDataURL()

v1.x
Tj Holowaychuk 14 years ago
parent
commit
4fa8e852cf
  1. 7
      test/server.js

7
test/server.js

@ -37,8 +37,13 @@ app.post('/render', function(req, res, next){
, canvas = new Canvas(width, height)
, ctx = canvas.getContext('2d')
, start = new Date;
fn(ctx);
res.send({ data: canvas.toDataURL(), duration: new Date - start });
var duration = new Date - start;
canvas.toDataURL(function(err, str){
res.send({ data: str, duration: duration });
});
});
app.listen(3000);

Loading…
Cancel
Save