From 42b1770869f83d5f1f33b03040e1ec0ed073e24b Mon Sep 17 00:00:00 2001 From: Luis Leiva Date: Mon, 18 Dec 2017 09:04:57 +0100 Subject: [PATCH] Ensure callback --- jsketch.svg.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jsketch.svg.js b/jsketch.svg.js index b36e509..48109ac 100644 --- a/jsketch.svg.js +++ b/jsketch.svg.js @@ -21,6 +21,8 @@ * @name toSVG */ window.jSketch.prototype.toSVG = function(callback) { + // No callback, no SVG. + if (typeof callback !== 'function') throw new Error('You must supply a callback in toSVG() method.'); // Save pointer for use in closures. var self = this; // Gather lines together until path is closed. @@ -192,6 +194,7 @@ */ methods.stroke = methods.closePath; + // Create SVG. function build() { var svg = ''; svg += '