Add typings for jQuery.areYouSure

Add typings for jQuery.areYouSure dirty form monitoring plugin
This commit is contained in:
Jon Egerton
2013-08-21 23:40:47 +01:00
parent a63c95b833
commit 49444066cb
3 changed files with 51 additions and 1 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
DefinitelyTyped [![Build Status](https://travis-ci.org/borisyankov/DefinitelyTyped.png?branch=master)](https://travis-ci.org/borisyankov/DefinitelyTyped)
DefinitelyTyped [![Build Status](https://travis-ci.org/borisyankov/DefinitelyTyped.png?branch=master)](https://travis-ci.org/borisyankov/DefinitelyTyped)
===============
The repository for *high quality* TypeScript type definitions.
@@ -93,6 +93,7 @@ List of Definitions
* [jQuery](http://jquery.com/) (from TypeScript samples)
* [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery.areYouSure](https://github.com/codedance/jquery.AreYouSure) (by [Jon Egerton](https://github.com/jonegerton))
* [jQuery.autosize](http://www.jacklmoore.com/autosize/) (by [Jack Moore](http://www.jacklmoore.com/))
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
@@ -0,0 +1,18 @@
// Type definitions for jquery.are-you-sure.js
// Project: https://github.com/codedance/jquery.AreYouSure
// Definitions by: Jon Egerton <https://github.com/jonegerton>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery.are-you-sure.d.ts"/>
//Use defaults
$("test").areYouSure();
//Use all settings
$("test").areYouSure({
message: "Oops - sure you wanna leave?",
dirtyClass: "soiled",
fieldSelector: "input[type='text']",
change: function () { alert("changed");}
})
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for jquery.are-you-sure.js
// Project: https://github.com/codedance/jquery.AreYouSure
// Definitions by: Jon Egerton <https://github.com/jonegerton>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/**Options available to control dirty form checking*/
interface AreYouSureOptions {
/**Message to show when attempting to quit a dirty form without saving*/
message?: string;
/**Class to assign to the form when dirty*/
dirtyClass?: string;
/**Callback when form is found to be dirty - allows control of submit/reset buttons etc*/
change?: Function;
/**Jquery selector to use to find input elements*/
fieldSelector?: string;
}
interface AreYouSure {
(): JQuery;
(options: AreYouSureOptions): JQuery;
}
interface JQuery {
areYouSure: AreYouSure;
}