Skip to content

Commit 4e4d10a

Browse files
authored
fix: Change this reference in client libraries to explicitly passed app (#1597)
1 parent 317a312 commit 4e4d10a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

packages/primus-client/lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ function primusClient (connection, options) {
1313
}));
1414
};
1515

16-
const initialize = function () {
17-
if (typeof this.defaultService === 'function') {
16+
const initialize = function (app) {
17+
if (typeof app.defaultService === 'function') {
1818
throw new Error('Only one default client provider can be configured');
1919
}
2020

21-
this.primus = connection;
22-
this.defaultService = defaultService;
21+
app.primus = connection;
22+
app.defaultService = defaultService;
2323
};
2424

2525
initialize.Service = Service;

packages/rest-client/lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ function restClient (base = '') {
3232
return new Service({ base, name, connection, options });
3333
};
3434

35-
const initialize = function () {
36-
if (typeof this.defaultService === 'function') {
35+
const initialize = function (app) {
36+
if (typeof app.defaultService === 'function') {
3737
throw new Error('Only one default client provider can be configured');
3838
}
3939

40-
this.rest = connection;
41-
this.defaultService = defaultService;
40+
app.rest = connection;
41+
app.defaultService = defaultService;
4242
};
4343

4444
initialize.Service = Service;

packages/socketio-client/lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ function socketioClient (connection, options) {
1919
return new Service(settings);
2020
};
2121

22-
const initialize = function () {
23-
if (typeof this.defaultService === 'function') {
22+
const initialize = function (app) {
23+
if (typeof app.defaultService === 'function') {
2424
throw new Error('Only one default client provider can be configured');
2525
}
2626

27-
this.io = connection;
28-
this.defaultService = defaultService;
27+
app.io = connection;
28+
app.defaultService = defaultService;
2929
};
3030

3131
initialize.Service = Service;

0 commit comments

Comments
 (0)