mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge pull request #1156 from JoshStrobl/master
Adding jQuery.Timer Definitions (Post-Fork Resync)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
DefinitelyTyped [](https://travis-ci.org/borisyankov/DefinitelyTyped)
|
||||
DefinitelyTyped [](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))
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="jquery.timer.d.ts" />
|
||||
|
||||
// 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
|
||||
@@ -0,0 +1 @@
|
||||
""
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for jQueryTimer 1.0
|
||||
// Project: https://github.com/jchavannes/jquery-timer
|
||||
// Definitions by: Joshua Strobl <https://github.com/JoshStrobl/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
""
|
||||
Reference in New Issue
Block a user