mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #46642 feat(long-timeout): new type definition by @MatthiasKunnen
* feat(long-timeout): new type definition * fix(long-timeout): remove export as namespace long-timeout does not have a UMD wrapper.
This commit is contained in:
parent
c6531e7ee6
commit
c7a768fca6
28
types/long-timeout/index.d.ts
vendored
Normal file
28
types/long-timeout/index.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Type definitions for long-timeout 0.1
|
||||
// Project: https://github.com/tellnes/long-timeout
|
||||
// Definitions by: Matthias Kunnen <https://github.com/MatthiasKunnen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type Listener = (...args: any[]) => void;
|
||||
|
||||
export class Timeout {
|
||||
after: number;
|
||||
close: () => void;
|
||||
listener: Listener;
|
||||
ref: () => void;
|
||||
start: () => void;
|
||||
unref: () => void;
|
||||
unreffed: boolean;
|
||||
|
||||
constructor(listener: Listener, ms: number);
|
||||
}
|
||||
|
||||
export type Interval = Timeout;
|
||||
|
||||
export function clearInterval(timer: Interval): void;
|
||||
|
||||
export function clearTimeout(timer: Timeout): void;
|
||||
|
||||
export function setInterval(listener: Listener, ms: number): Interval;
|
||||
|
||||
export function setTimeout(listener: Listener, ms: number): Timeout;
|
||||
15
types/long-timeout/long-timeout-tests.ts
Normal file
15
types/long-timeout/long-timeout-tests.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as lt from 'long-timeout';
|
||||
|
||||
const interval = lt.setInterval(() => {
|
||||
// Do things
|
||||
}, 4000);
|
||||
|
||||
interval.close();
|
||||
|
||||
lt.clearInterval(interval);
|
||||
|
||||
const timeout = lt.setTimeout(() => {
|
||||
// Do things
|
||||
}, 50);
|
||||
|
||||
lt.clearTimeout(timeout);
|
||||
23
types/long-timeout/tsconfig.json
Normal file
23
types/long-timeout/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"long-timeout-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/long-timeout/tslint.json
Normal file
1
types/long-timeout/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user