mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #26835 from gjurgens/node-ipc-unsubscribe-server-events
[@types/node-ipc]: Adding 'off' (unsubcribe) method to server class
This commit is contained in:
Vendored
+5
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for node-ipc 9.1
|
||||
// Project: http://riaevangelist.github.io/node-ipc/
|
||||
// Definitions by: Arvitaly <https://github.com/arvitaly>
|
||||
// Definitions by: Arvitaly <https://github.com/arvitaly>, gjurgens <https://github.com/gjurgens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference types="node" />
|
||||
import { Socket } from "net";
|
||||
@@ -178,6 +178,10 @@ declare namespace NodeIPC {
|
||||
*/
|
||||
on(event: "data", callback: (buffer: Buffer) => void): Client;
|
||||
emit(event: string, value?: any): Client;
|
||||
/**
|
||||
* Unbind subscribed events
|
||||
*/
|
||||
off(event: string, handler: any): Client;
|
||||
}
|
||||
interface Server extends Client {
|
||||
/**
|
||||
|
||||
@@ -63,3 +63,4 @@ declare const socket: Socket;
|
||||
ipc.server.emit(socket, myBuffer);
|
||||
ipc.server.emit([10, 20, 30]);
|
||||
ipc.server.emit({ address: 'localhost', port: 8000 }, "message", { id: ipc.config.id, message: 'Goodbye' });
|
||||
ipc.server.off("error", "*");
|
||||
|
||||
Reference in New Issue
Block a user