Add .on() function to zeromq and a test for it.

This commit is contained in:
Panu Horsmalahti
2014-12-08 12:02:25 +02:00
parent 72f8dbc007
commit b353038db3
2 changed files with 13 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
/// <reference path='zmq.d.ts' />
/// <reference path='../node/node-0.11.d.ts' />
import zmq = require('zmq');
@@ -18,6 +19,9 @@ function test3() {
var sock = zmq.socket('push');
sock.bindSync('tcp://127.0.0.1:3000');
sock.send(['hello', 'world']);
sock.on('message', function (buffer: Buffer) {
//
});
}
function test4() {

View File

@@ -3,6 +3,8 @@
// Definitions by: Dave McKeown <http://github.com/davemckeown>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../node/node-0.11.d.ts' />
interface EventEmitter {}
declare module 'zmq' {
@@ -150,6 +152,13 @@ declare module 'zmq' {
*/
close(): Socket;
/**
* Socket event
* @param eventName {string}
* @param callback {Function}
*/
on(eventName: string, callback: (buffer: Buffer) => void): void;
// Socket Options
_fd: any;
_ioevents: any;