Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#50251 [pause-me]: create typings by @scree…
Browse files Browse the repository at this point in the history
  • Loading branch information
screendriver authored Dec 23, 2020
1 parent 6cf8495 commit 0558a73
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
26 changes: 26 additions & 0 deletions types/pause-me/index.d.ts
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;
11 changes: 11 additions & 0 deletions types/pause-me/pause-me-tests.ts
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);
23 changes: 23 additions & 0 deletions types/pause-me/tsconfig.json
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"
]
}
1 change: 1 addition & 0 deletions types/pause-me/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit 0558a73

Please sign in to comment.