Skip to content

Commit

Permalink
promise
Browse files Browse the repository at this point in the history
  • Loading branch information
ingpdw committed Sep 27, 2012
1 parent 4549aed commit 7737d81
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions promise.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

g.canvas = document.getElementById('canvas');

g.context = g.canvas.getContext('2d');

g.update = function(){
draw();
}

g.draw = function(){
var tmp = document.createElement('canvas'),
tmpCtx = tmp.getContext('2d');

tmp.width = g.canvas.width;
tmp.height = g.cavnas.height;

tmp.drawRect(0, 0, 10, 10);

g.canvas.drawImage(tmp, 0, 0);

// remove expensive drawing
// var iData = tmpCtx.getImageData(0, 0, tmp.width, tmp.height);
// g.context.putImageData(iData, 0, 0);
}

setInterval(update, 16);

0 comments on commit 7737d81

Please sign in to comment.