DefinitelyTyped/countdown/countdown-tests.ts
Gabriel JUCHAULT 0c98b15167 Countdown.js (#10218)
* Countdown.js

* Remove header tags from tests

* fix(countdownjs): removed var
2016-07-23 23:31:51 -07:00

43 lines
1.1 KiB
TypeScript

/// <reference path="countdown.d.ts" />
import { countdown, Timespan, CountdownStatic, Format } from 'countdown';
let ts: Timespan;
let interval: number;
ts = <Timespan>countdown(new Date());
ts = <Timespan>countdown(150);
interval = <number>countdown(new Date(),
function (ts: Timespan) {
document.getElementById('pageTimer').innerHTML = ts.toHTML('strong');
},
countdown.HOURS | countdown.MINUTES | countdown.SECONDS,
2,
2
);
clearInterval(interval);
ts.toString('foo');
ts.toHTML('em', 'foo');
countdown.resetFormat();
countdown.setLabels('a', 'b', 'c', 'd', 'e');
countdown.setLabels('a', 'b', 'c', 'd', 'e', function (value: number): string {
return 'ok';
}, function (value: number, unit: number): string {
return 'ok';
});
countdown.setLabels(null, null, null, null, 'Now.');
countdown.setLabels(
' millisecond| second| minute| hour| day| week| month| year| decade| century| millennium',
' milliseconds| seconds| minutes| hours| days| weeks| months| years| decades| centuries| millennia',
' and ',
', ',
'',
n => n.toString());