Skip to content

Commit

Permalink
fix: Change this reference in client libraries to explicitly passed a…
Browse files Browse the repository at this point in the history
…pp (#1597)
  • Loading branch information
daffl authored Oct 4, 2019
1 parent 317a312 commit 4e4d10a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/primus-client/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions packages/rest-client/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions packages/socketio-client/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e4d10a

Please sign in to comment.