mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 14:59:37 +08:00
Adding jQuery.Timer Definitions (Post-Fork Resync)
This is to add the jQuery.Timer definitions and tests, as well as the tscparams that seem to be required (hopefully DefinitelyTyped Travis CI builds will work this time). Modified alert() to be console.log() instead. Readme updated as well (ignore line #1).
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))
|
||||
|
||||
31
jquery.timer/jquery.timer-tests.ts
Normal file
31
jquery.timer/jquery.timer-tests.ts
Normal file
@@ -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
|
||||
1
jquery.timer/jquery.timer-tests.ts.tscparams
Normal file
1
jquery.timer/jquery.timer-tests.ts.tscparams
Normal file
@@ -0,0 +1 @@
|
||||
""
|
||||
31
jquery.timer/jquery.timer.d.ts
vendored
Normal file
31
jquery.timer/jquery.timer.d.ts
vendored
Normal file
@@ -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;
|
||||
}
|
||||
1
jquery.timer/jquery.timer.d.ts.tscparams
Normal file
1
jquery.timer/jquery.timer.d.ts.tscparams
Normal file
@@ -0,0 +1 @@
|
||||
""
|
||||
Reference in New Issue
Block a user