Wanna try the jQuery-friendly version?
(function() {
var sketcher = new Sketchable(document.getElementById('drawing-canvas'));
var outputEl = document.getElementById('drawing-data');
document.getElementById('tosvg').addEventListener('click', function(evt) {
evt.preventDefault();
sketcher.svg.create(function(contents) {
outputEl.textContent = contents;
});
});
document.getElementById('clear').addEventListener('click', function(evt) {
evt.preventDefault();
sketcher.clear();
outputEl.textContent = '';
});
})();