mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Add declarations for stoppable 1.1
This commit is contained in:
Vendored
+7
-2
@@ -1,11 +1,16 @@
|
||||
// Type definitions for stoppable 1.0
|
||||
// Type definitions for stoppable 1.1
|
||||
// Project: https://github.com/hunterloftis/stoppable
|
||||
// Definitions by: Eric Byers <https://github.com/EricByers>
|
||||
// John Plusjé <https://github.com/jplusje>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
import { Server } from 'http';
|
||||
|
||||
declare function stoppable(server: Server, grace?: number): Server;
|
||||
interface StoppableServer extends Server {
|
||||
stop(callback?: (e: Error, gracefully: boolean) => void): void;
|
||||
}
|
||||
|
||||
declare function stoppable(server: Server, grace?: number): StoppableServer;
|
||||
|
||||
export = stoppable;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import * as http from 'http';
|
||||
import stoppable = require('stoppable');
|
||||
|
||||
const server: http.Server = stoppable(http.createServer());
|
||||
server.close();
|
||||
const server = stoppable(http.createServer());
|
||||
server.stop();
|
||||
|
||||
const server2: http.Server = stoppable(http.createServer(), 10000);
|
||||
server2.close();
|
||||
const server2 = stoppable(http.createServer(), 10000);
|
||||
server2.stop();
|
||||
|
||||
const server3 = stoppable(http.createServer());
|
||||
server.stop((err, gracefully) => {});
|
||||
|
||||
Reference in New Issue
Block a user