Browse Source

test server using async toDataURL()

v1.x
Tj Holowaychuk 15 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) , canvas = new Canvas(width, height)
, ctx = canvas.getContext('2d') , ctx = canvas.getContext('2d')
, start = new Date; , start = new Date;
fn(ctx); 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); app.listen(3000);

Loading…
Cancel
Save