brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
694 stars 529 forks source link

TypeScript #112

Open MickL opened 8 years ago

MickL commented 8 years ago

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.

nealeu commented 8 years ago

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];
MickL commented 8 years ago

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

nealeu commented 8 years ago

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.

onyxcool commented 7 years ago

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

onyxcool commented 7 years ago

@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