diff --git a/README.md b/README.md index 780f87c306..3484db60dc 100755 --- a/README.md +++ b/README.md @@ -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. @@ -127,6 +127,7 @@ List of Definitions * [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski)) * [jQuery.timeago](http://timeago.yarp.com/) (by [François Guillot](http://fguillot.developpez.com/)) * [jQuery.Timepicker](http://fgelinas.com/code/timepicker/) (by [Anwar Javed](https://github.com/anwarjaved)) +* [jQuery.Timer](http://jchavannes.com/jquery-timer/demo) (by [Joshua Strobl](https://github.com/JoshStrobl)) * [jQuery.TinyCarousel](http://baijs.nl/tinycarousel/) (by [Christiaan Rakowski](https://github.com/csrakowski)) * [jQuery.TinyScrollbar](http://baijs.nl/tinyscrollbar/) (by [Christiaan Rakowski](https://github.com/csrakowski)) * [jQuery.Transit](http://ricostacruz.com/jquery.transit/) (by [MrBigDog2U](https://github.com/MrBigDog2U)) diff --git a/jquery.timer/jquery.timer-tests.ts b/jquery.timer/jquery.timer-tests.ts new file mode 100644 index 0000000000..2e48bbe893 --- /dev/null +++ b/jquery.timer/jquery.timer-tests.ts @@ -0,0 +1,31 @@ +/// +/// + + // Create the timer + $("body").timer( + function () { + console.log("This function just got called"); + }, 10000, true + ); + + $("body").timer.set({ time: 5000 }); // Change the time from 10000 millseconds to 5000 milliseconds + $("body").timer.toggle(false); // Reset the timer + $("body").timer.stop(); // Stop the timer + $("body").timer.play(); // Start / play the timer + + // #region Outputting if timer is active or not + var isTimerActive = $("body").timer.isActive; // Define boolean isActive as isTimerActive + if (isTimerActive == true){ + console.log("Timer is active!"); + } + else{ + console.log("Timer is not active!"); + } + // #endregion + + // #region Get time remaining + console.log("Time remaining on timer: " + $("body").timer.remaining.toString); + // #endregion + + $("body").timer.stop(); // Stop the timer once more for the purpose of the tests (to test once()) + $("body").timer.once(1000); // Run the timer ONCE in 1 second \ No newline at end of file diff --git a/jquery.timer/jquery.timer-tests.ts.tscparams b/jquery.timer/jquery.timer-tests.ts.tscparams new file mode 100644 index 0000000000..e16c76dff8 --- /dev/null +++ b/jquery.timer/jquery.timer-tests.ts.tscparams @@ -0,0 +1 @@ +"" diff --git a/jquery.timer/jquery.timer.d.ts b/jquery.timer/jquery.timer.d.ts new file mode 100644 index 0000000000..7777585076 --- /dev/null +++ b/jquery.timer/jquery.timer.d.ts @@ -0,0 +1,31 @@ +// Type definitions for jQueryTimer 1.0 +// Project: https://github.com/jchavannes/jquery-timer +// Definitions by: Joshua Strobl +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQueryTimer { + // #region Constructors + (action?: Function, time?: Number, autostart?: Boolean): Object; + set(any): Object; + // #endregion + + // #region Actions + once(time: Number): Object; + play(reset?: Boolean): Object; + pause(): Object; + stop(): Object; + toggle(reset?: Boolean): Object; + // #endregion + + // #region Properties + isActive: Boolean; + remaining: Number; + // #endregion + +} + +interface JQuery { + timer: JQueryTimer; +} \ No newline at end of file diff --git a/jquery.timer/jquery.timer.d.ts.tscparams b/jquery.timer/jquery.timer.d.ts.tscparams new file mode 100644 index 0000000000..3cc762b550 --- /dev/null +++ b/jquery.timer/jquery.timer.d.ts.tscparams @@ -0,0 +1 @@ +"" \ No newline at end of file