Merge pull request #365 from vbortone/feature/jquery.livestampjs

Type definitions for Livestamp.js
This commit is contained in:
Diullei Gomes
2013-03-02 19:54:04 -08:00
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
// Tests for Livestamp.js type definitions
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="../moment/moment.d.ts"/>
/// <reference path="jquery.livestampjs.d.ts"/>
$('#test1').livestamp(new Date('June 18, 1987'));
$('#test2').livestamp(1362282933);
$('#test3').livestamp('destroy');
$('#test4').livestamp(moment(new Date('June 18, 1987')));
$.livestamp.update();
$.livestamp.pause();
$.livestamp.resume();
$.livestamp.interval(340);
var result:number = $.livestamp.interval();

View File

@@ -0,0 +1,27 @@
// Type definitions for Livestamp.js
// A simple, unobtrusive jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements using Moment.js.
// Project: http://http://mattbradley.github.com/livestampjs/
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="../moment/moment.d.ts"/>
interface LivestampGlobal {
update(): void;
pause(): void;
resume(): void;
interval(): number;
interval(interval: number): void;
}
interface JQueryStatic {
livestamp: LivestampGlobal;
}
interface JQuery {
livestamp(date: Date): JQuery;
livestamp(moment: Moment): JQuery;
livestamp(timestamp: number): JQuery;
livestamp(timestamp: string): JQuery;
}