Comparing version 0.26.4 to 0.27.0
// Generated by LiveScript 1.5.0 | ||
var EventEmitter, HandlerManager, ref$, delegate, delegateEvent, WebSocketConnector, debug, ExoRelay; | ||
var EventEmitter, HandlerManager, ref$, delegate, delegateEvent, WebSocketConnector, isPlainObject, isFunction, debug, ExoRelay; | ||
EventEmitter = require('events').EventEmitter; | ||
@@ -7,2 +7,4 @@ HandlerManager = require('./message-handler/message-manager'); | ||
WebSocketConnector = require('./websocket-connector/websocket-connector'); | ||
isPlainObject = require('lodash/isPlainObject'); | ||
isFunction = require('lodash/isFunction'); | ||
debug = require('debug')('exorelay'); | ||
@@ -49,9 +51,12 @@ ExoRelay = (function(superclass){ | ||
var message; | ||
if (typeof options !== 'object') { | ||
if (isFunction(options)) { | ||
replyHandler = options; | ||
options = {}; | ||
} | ||
if (replyHandler && typeof replyHandler !== 'function') { | ||
return this.emit('error', Error('The reply handler given to ExoRelay#send must be a function')); | ||
if (options && !isPlainObject(options)) { | ||
return this.emit('error', Error('The third argument to ExoRelay#send must be an object (when supplying options) or a function (when supplying a reply handler)')); | ||
} | ||
if (replyHandler && !isFunction(replyHandler)) { | ||
return this.emit('error', Error('The fourth argument to ExoRelay#send must be a function')); | ||
} | ||
message = this.websocketConnector.send(messageName, payload, options); | ||
@@ -58,0 +63,0 @@ if (replyHandler) { |
@@ -104,5 +104,8 @@ // Generated by LiveScript 1.5.0 | ||
WebSocketConnector.prototype._onSocketClose = function(){ | ||
var this$ = this; | ||
if (this.shouldReconnectOnSocketClosed) { | ||
if (this.shouldUseInternalReconnect) { | ||
return this._internalConnect(); | ||
return setTimeout(function(){ | ||
return this$._internalConnect(); | ||
}, 100); | ||
} else { | ||
@@ -109,0 +112,0 @@ return this.connect(); |
{ | ||
"name": "exorelay", | ||
"version": "0.26.4", | ||
"version": "0.27.0", | ||
"author": "Kevin Goslar", | ||
@@ -8,2 +8,3 @@ "dependencies": { | ||
"debug": "3.0.1", | ||
"lodash": "^4.17.4", | ||
"rails-delegate": "0.6.2", | ||
@@ -10,0 +11,0 @@ "uuid": "3.1.0", |
24114
494
7
+ Addedlodash@^4.17.4
+ Addedlodash@4.17.21(transitive)