jSignature icon indicating copy to clipboard operation
jSignature copied to clipboard

TypeScript

Open MickL opened this issue 8 years ago • 5 comments

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.

MickL avatar May 30 '16 12:05 MickL

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];

nealeu avatar Jun 14 '16 15:06 nealeu

I wanted to contribute. Btw you dont have to write by use of definition files.

MickL avatar Jun 14 '16 15:06 MickL

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.

nealeu avatar Jun 14 '16 18:06 nealeu

Hi @nealeu, I would be really appreciate if you share the status about the jSignature reactJs version. Is it complete?

onyxcool avatar Apr 24 '17 15:04 onyxcool

@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

onyxcool avatar Apr 24 '17 15:04 onyxcool