diff --git a/packages/primus-client/lib/index.js b/packages/primus-client/lib/index.js index 9e0c1d9f6d..afd97f05b7 100644 --- a/packages/primus-client/lib/index.js +++ b/packages/primus-client/lib/index.js @@ -13,13 +13,13 @@ function primusClient (connection, options) { })); }; - const initialize = function () { - if (typeof this.defaultService === 'function') { + const initialize = function (app) { + if (typeof app.defaultService === 'function') { throw new Error('Only one default client provider can be configured'); } - this.primus = connection; - this.defaultService = defaultService; + app.primus = connection; + app.defaultService = defaultService; }; initialize.Service = Service; diff --git a/packages/rest-client/lib/index.js b/packages/rest-client/lib/index.js index dfa31bce8f..e486b54cf8 100644 --- a/packages/rest-client/lib/index.js +++ b/packages/rest-client/lib/index.js @@ -32,13 +32,13 @@ function restClient (base = '') { return new Service({ base, name, connection, options }); }; - const initialize = function () { - if (typeof this.defaultService === 'function') { + const initialize = function (app) { + if (typeof app.defaultService === 'function') { throw new Error('Only one default client provider can be configured'); } - this.rest = connection; - this.defaultService = defaultService; + app.rest = connection; + app.defaultService = defaultService; }; initialize.Service = Service; diff --git a/packages/socketio-client/lib/index.js b/packages/socketio-client/lib/index.js index e244945327..e31ec04f8f 100644 --- a/packages/socketio-client/lib/index.js +++ b/packages/socketio-client/lib/index.js @@ -19,13 +19,13 @@ function socketioClient (connection, options) { return new Service(settings); }; - const initialize = function () { - if (typeof this.defaultService === 'function') { + const initialize = function (app) { + if (typeof app.defaultService === 'function') { throw new Error('Only one default client provider can be configured'); } - this.io = connection; - this.defaultService = defaultService; + app.io = connection; + app.defaultService = defaultService; }; initialize.Service = Service;