jSignature
jSignature copied to clipboard
TypeScript
Any chance of a TypeScript conversion?
I would have made some pull requests then, adding a manual rerender functionality and showing a message when signing out of borders. But this plain JavaScript code is too hard for me to understand.
Are you suggesting Typescript because you want to contribute to jSignature? If you just want to use it, then that's easy enough from Typescript
Assuming you have you can load jSignature as a module: e.g. for requirejs
requirejs.config({
paths: {
"jsignature" : "jSignature/jSignature.min.noconflict"
} });
Then you can use
import $ = require("jquery");
import "jSignature"; // for side effects of adding plugin
var sig = $("<div>");
(<any> sig).jSignature({
UndoButton: true
});
var svgXml = (<any> sig).jSignature("getData", "svg")[1];
I wanted to contribute.
Btw you dont have to write
Hi,
If you've got jsignature.d.ts working, then do tell. I've found trying to get JQuery plugins working that way to be painful, although I last tried in Typescript 1.3.
I'm also interested in development and would find a modular approach useful - in particular because I'd love to do a ReactJS version of jSignature, and this would share code with the jQuery plugin.
Hi @nealeu, I would be really appreciate if you share the status about the jSignature reactJs version. Is it complete?
@nealeu if there is no ReactJS version yet, would you be kind to describe in more details how did you use jSignature as a module here requirejs.config({ paths: { "jsignature" : "jSignature/jSignature.min.noconflict" } });
Can I do this with typescript + webpack?
thank you