Skip to content

Commit a6ecbed

Browse files
committed
Added definitions for JQuery plugin jSignature
Definitions for jSignature jQuery plugin including tests for definitionss. Included are some documentation on the typed definition functions making use of JDocs TypeScript support. Updated the readme to include the new Typed Definition. Included empty tscparams files to be consistent with other definitions in the project.
1 parent b801205 commit a6ecbed

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ List of Definitions
144144
* [jQuery.gridster](http://gridster.net) (by [Josh Baldwin](https://github.com/jbaldwin/gridster.d.ts))
145145
* [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/))
146146
* [jQuery.joyride](http://zurb.com/playground/jquery-joyride-feature-tour-plugin) (by [Vincent Bortone](https://github.com/vbortone))
147+
* [jQuery.jSignature] (https://github.com/willowsystems/jSignature) (by [Patrick Magee](https://github.com/pjmagee))
147148
* [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/))
148149
* [jQuery.pickadate](https://github.com/amsul/pickadate.js) (by [Theodore Brown](https://github.com/theodorejb))
149150
* [jQuery.payment](http://needim.github.io/noty/) (by [Eric J. Smith](https://github.com/ejsmith/))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// <reference path='../jquery/jquery.d.ts'/>
2+
/// <reference path='jquery.jsignature.d.ts'/>
3+
4+
/*
5+
* Taken from the tests section on jSignature
6+
*/
7+
$(document).ready(function () {
8+
9+
var $sigdiv = $('#signature');
10+
11+
$sigdiv.jSignature();
12+
13+
$sigdiv.jSignature("reset");
14+
15+
var data = $sigdiv.jSignature("getData", "svgbase64");
16+
17+
$sigdiv.jSignature("setData", "data:" + data);
18+
19+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
""
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Type definitions for jQuery.jsignature v2
2+
// Project: https://github.com/willowsystems/jSignature
3+
// Definitions by: Patrick Magee <https://github.com/pjmagee>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
// Project by: Willow Systems Corp
6+
7+
/// <reference path='../jquery/jquery.d.ts'/>
8+
9+
interface JQuery {
10+
11+
/**
12+
* inits the jSignature widget
13+
*/
14+
jSignature(): JQuery;
15+
16+
/**
17+
* Arguments vary per command. When provided, command is expected to be a string with a command for jSignature. Commands supported at this time: init, reset, getData, setData, listPlugins
18+
* @summary
19+
* init is the default, assumed action. init takes one argument - a settings Object. You can omit the command and just pass the settings object in upon init. Returns (in a traditional jQuery chainable way) jQuery object ref to the element onto which the plugin was applied.
20+
* clear (also aliased as reset) clears the signature pad, data store (and puts back signature line and other decor). Returns (in a traditional jQuery chainable way) jQuery object ref to the element onto which the plugin was applied.
21+
* getData takes an argument - the name of the data format. Returns a data object appropriate for the data format.
22+
* setData (also aliased as importData) takes two arguments - data object, (optional) data format name. When data object is a string formatted in data-url pattern you don't need to specify the data dormat name. The data format name (mime) will be implied from the data-url prefix. Returns (in a traditional jQuery chainable way) jQuery object ref to the element onto which the plugin was applied.
23+
* listPlugins takes an argument - a string denoting the category (Only export, import supported at this time) of plugins to list. Returns an array of strings.
24+
*
25+
* @param command the command used to perform an action on the jSignature canvas
26+
* @see http://willowsystems.github.io/jSignature/#/about/
27+
*
28+
*/
29+
jSignature(command: string): any;
30+
31+
/**
32+
* Arguments vary per command. When provided, command is expected to be a string with a command for jSignature. Commands supported at this time: init, reset, getData, setData, listPlugins
33+
* @summary
34+
* init is the default, assumed action. init takes one argument - a settings Object. You can omit the command and just pass the settings object in upon init. Returns (in a traditional jQuery chainable way) jQuery object ref to the element onto which the plugin was applied.
35+
* clear (also aliased as reset) clears the signature pad, data store (and puts back signature line and other decor). Returns (in a traditional jQuery chainable way) jQuery object ref to the element onto which the plugin was applied.
36+
* getData takes an argument - the name of the data format. Returns a data object appropriate for the data format.
37+
* setData (also aliased as importData) takes two arguments - data object, (optional) data format name. When data object is a string formatted in data-url pattern you don't need to specify the data dormat name. The data format name (mime) will be implied from the data-url prefix. Returns (in a traditional jQuery chainable way) jQuery object ref to the element onto which the plugin was applied.
38+
* listPlugins takes an argument - a string denoting the category (Only export, import supported at this time) of plugins to list. Returns an array of strings.
39+
*
40+
* @param command the command used to perform an action on the jSignature canvas
41+
* @param arg the argument used with the specified command
42+
* @see http://willowsystems.github.io/jSignature/#/about/
43+
*
44+
*/
45+
jSignature(command: string, ...arg: string[]): any;
46+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
""

0 commit comments

Comments
 (0)