pub-emitter.js 468 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Module dependencies.
  3. */
  4. var PubSocket = require('./pub');
  5. /**
  6. * Expose `SubPubEmitterSocket`.
  7. */
  8. module.exports = PubEmitterSocket;
  9. /**
  10. * Initialzie a new `PubEmitterSocket`.
  11. *
  12. * @api private
  13. */
  14. function PubEmitterSocket() {
  15. this.sock = new PubSocket;
  16. this.emit = this.sock.send.bind(this.sock);
  17. this.bind = this.sock.bind.bind(this.sock);
  18. this.connect = this.sock.connect.bind(this.sock);
  19. this.close = this.sock.close.bind(this.sock);
  20. }