Closed raphinesse closed 5 years ago
@raphinesse thanks for the suggestion! I agree completely that such a signature would work better. It is an API-breaking change, so I'm going to flag this for v0.3.0.
Please do submit PRs if you can.
stupid me, I meant to say v1.0.0
It doesn't have to be breaking. You could still support the old API and deprecate it. Something along the lines of:
function atrament(canvas, options) {
if (typeof options === 'number') {
console.warn('Calling style deprecated. Use new style instead. [Further information]')
// convert old style arguments to options object
}
// Use new options object
}
To be more concise: overload the function :relaxed:
I guess it would be far more useful to have a signature like this
where the second parameter is an object with properties corresponding to the publicly available properties on
Atrament
instances (according to the docs, that would includeweight
,color
,smoothing
,adaptiveStroke
,mode
andopacity
) pluswidth
andheight
(Even if I'd argue that you don't really need these last two. They're easily enough configured through the canvas element itself).