@@ -57,7 +57,7 @@ const shortOptions = {
5757 connect_timeout : longOptions . ZMQ_CONNECT_TIMEOUT ,
5858}
5959
60- class Context {
60+ export class Context {
6161 static setMaxThreads ( value : number ) {
6262 zmq . context . ioThreads = value
6363 }
@@ -79,7 +79,10 @@ class Context {
7979 }
8080}
8181
82- type SocketType =
82+ /**
83+ * All the socket types available in the compatibility layer
84+ */
85+ export type SocketType =
8386 | "pair"
8487 | "req"
8588 | "rep"
@@ -97,7 +100,7 @@ type SocketType =
97100
98101type Callback = ( err ?: Error ) => void
99102
100- class Socket extends EventEmitter {
103+ export class Socket extends EventEmitter {
101104 [ key : string ] : any
102105
103106 type : SocketType
@@ -729,7 +732,7 @@ for (const key in shortOptions) {
729732 } )
730733}
731734
732- function createSocket ( type : SocketType , options : { [ key : string ] : any } = { } ) {
735+ export function createSocket ( type : SocketType , options : { [ key : string ] : any } = { } ) {
733736 const sock = new Socket ( type )
734737 for ( const key in options ) {
735738 if ( options . hasOwnProperty ( key ) ) {
@@ -739,12 +742,12 @@ function createSocket(type: SocketType, options: {[key: string]: any} = {}) {
739742 return sock
740743}
741744
742- function curveKeypair ( ) {
745+ export function curveKeypair ( ) {
743746 const { publicKey, secretKey} = zmq . curveKeyPair ( )
744747 return { public : publicKey , secret : secretKey }
745748}
746749
747- function proxy ( frontend : Socket , backend : Socket , capture ?: Socket ) {
750+ export function proxy ( frontend : Socket , backend : Socket , capture ?: Socket ) {
748751 switch ( `${ frontend . type } /${ backend . type } ` ) {
749752 case "push/pull" :
750753 case "pull/push" :
@@ -790,17 +793,10 @@ function proxy(frontend: Socket, backend: Socket, capture?: Socket) {
790793 }
791794}
792795
793- const version = zmq . version
796+ export const version = zmq . version
794797
795798export {
796- version ,
797- Context ,
798- Socket ,
799- SocketType ,
800799 createSocket as socket ,
801- createSocket ,
802- curveKeypair ,
803- proxy ,
804800 shortOptions as options ,
805801}
806802
0 commit comments