Skip to content

Instantly share code, notes, and snippets.

@darbicus
Created February 27, 2014 03:35
Show Gist options
  • Save darbicus/9243904 to your computer and use it in GitHub Desktop.
Save darbicus/9243904 to your computer and use it in GitHub Desktop.
clock.js
onmessage = function (event) {
var context = new CanvasRenderingContext2D();
event.data.setContext(context); // event.data is the CanvasProxy object
setInterval(function () {
context.clearRect(0, 0, context.width, context.height);
context.fillText(new Date(), 0, 100);
context.commit();
}, 1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment