Skip to content

Commit 661ab2d

Browse files
committed
Fix for interceptor function context binding
1 parent 65f04bf commit 661ab2d

File tree

2 files changed

+21
-24
lines changed

2 files changed

+21
-24
lines changed

dist/angular-loading-overlay-http-interceptor.js

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,26 @@
7373
"use strict";
7474
var BsLoadingOverlayHttpInterceptorInterceptor = (function () {
7575
function BsLoadingOverlayHttpInterceptorInterceptor(config, bsLoadingOverlayService) {
76+
var _this = this;
7677
this.config = config;
7778
this.bsLoadingOverlayService = bsLoadingOverlayService;
7879
this.requestsCount = 0;
80+
this.request = function (config) {
81+
_this.onRequest();
82+
return config;
83+
};
84+
this.requestError = function (rejection) {
85+
_this.onResponse();
86+
return rejection;
87+
};
88+
this.response = function (response) {
89+
_this.onResponse();
90+
return response;
91+
};
92+
this.responseError = function (rejection) {
93+
_this.onResponse();
94+
return rejection;
95+
};
7996
}
8097
BsLoadingOverlayHttpInterceptorInterceptor.prototype.onRequest = function () {
8198
if (this.requestsCount === 0) {
@@ -89,26 +106,6 @@
89106
this.bsLoadingOverlayService.stop(this.config);
90107
}
91108
};
92-
BsLoadingOverlayHttpInterceptorInterceptor.prototype.request = function (config) {
93-
this.onRequest();
94-
return config;
95-
};
96-
;
97-
BsLoadingOverlayHttpInterceptorInterceptor.prototype.requestError = function (rejection) {
98-
this.onResponse();
99-
return rejection;
100-
};
101-
;
102-
BsLoadingOverlayHttpInterceptorInterceptor.prototype.response = function (response) {
103-
this.onResponse();
104-
return response;
105-
};
106-
;
107-
BsLoadingOverlayHttpInterceptorInterceptor.prototype.responseError = function (rejection) {
108-
this.onResponse();
109-
return rejection;
110-
};
111-
;
112109
return BsLoadingOverlayHttpInterceptorInterceptor;
113110
}());
114111
Object.defineProperty(exports, "__esModule", { value: true });

source/BsLoadingOverlayHttpInterceptorInterceptor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ export default class BsLoadingOverlayHttpInterceptorInterceptor implements ng.IH
2525
}
2626
}
2727

28-
request(config: ng.IRequestConfig) {
28+
request = (config: ng.IRequestConfig) => {
2929
this.onRequest();
3030
return config;
3131
};
3232

33-
requestError(rejection) {
33+
requestError = (rejection) => {
3434
this.onResponse();
3535
return rejection;
3636
};
3737

38-
response(response: ng.IHttpPromiseCallbackArg<any>) {
38+
response = (response: ng.IHttpPromiseCallbackArg<any>) => {
3939
this.onResponse();
4040
return response;
4141
};
4242

43-
responseError(rejection) {
43+
responseError = (rejection) => {
4444
this.onResponse();
4545
return rejection;
4646
};

0 commit comments

Comments
 (0)