forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Merge PR DefinitelyTyped#50251 [pause-me]: create typings by @scree…
- Loading branch information
1 parent
6cf8495
commit 0558a73
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Type definitions for pause-me 1.1 | ||
// Project: https://github.com/jpehman/pause-mejs#readme | ||
// Definitions by: Christian Rackerseder <https://github.com/screendriver> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference types="node" /> | ||
|
||
declare namespace pauseMe { | ||
interface PausableTimeout { | ||
start(): void; | ||
pause(): void; | ||
resume(): void; | ||
stop(): void; | ||
timer(): NodeJS.Timeout | null; | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param callback function or lambda that you want executed after duration | ||
* @param duration Milliseconds to set the timeout to | ||
* @param repeating When true the timeout is treated as an interval | ||
*/ | ||
declare function pauseMe(callback: () => void, duration: number, repeating?: boolean): pauseMe.PausableTimeout; | ||
|
||
export = pauseMe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pauseMe = require('pause-me'); | ||
|
||
const myTimeout: pauseMe.PausableTimeout = pauseMe(() => {}, 5000); | ||
myTimeout.pause(); | ||
myTimeout.resume(); | ||
myTimeout.stop(); | ||
myTimeout.start(); | ||
if (myTimeout.timer() === null) { | ||
// myTimeout is not running | ||
} | ||
const myInterval = pauseMe(() => {}, 5000, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
"pause-me-tests.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "dtslint/dt.json" } |