@slavmak2486/bx24ts 1.1.28 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/BX24.ts +12 -0
- package/callResult.ts +1 -0
- package/dist/base/BX24.js +10 -0
- package/dist/callResult.js +2 -0
- package/package.json +1 -1
package/base/BX24.ts
CHANGED
|
@@ -50,6 +50,7 @@ export abstract class baseBX24{
|
|
|
50
50
|
APP_OPTIONS: any;
|
|
51
51
|
PLACEMENT_OPTIONS: any;
|
|
52
52
|
url='';
|
|
53
|
+
timeoutCall=0;
|
|
53
54
|
|
|
54
55
|
arrEvents:eventElement[]=[];
|
|
55
56
|
|
|
@@ -74,6 +75,13 @@ export abstract class baseBX24{
|
|
|
74
75
|
return encodeURIComponent(value);
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
setTimeoutCall(ms:number){
|
|
79
|
+
this.timeoutCall=ms;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
clearTimeoutCall(){
|
|
83
|
+
this.timeoutCall=0;
|
|
84
|
+
}
|
|
77
85
|
|
|
78
86
|
isFunction(item:any){
|
|
79
87
|
return item === null ? false : (typeof (item) == "function" || item instanceof Function);
|
|
@@ -235,6 +243,10 @@ export abstract class baseBX24{
|
|
|
235
243
|
url:url
|
|
236
244
|
};
|
|
237
245
|
|
|
246
|
+
if (this.timeoutCall){
|
|
247
|
+
options.timeout=this.timeoutCall;
|
|
248
|
+
}
|
|
249
|
+
|
|
238
250
|
axios(options).then(res=>{
|
|
239
251
|
const data = res.data;
|
|
240
252
|
const result = new CallResult(data, config, this, res.status);
|
package/callResult.ts
CHANGED
package/dist/base/BX24.js
CHANGED
|
@@ -24,6 +24,7 @@ class baseBX24 {
|
|
|
24
24
|
this.IS_ADMIN = false;
|
|
25
25
|
this.AUTH_EXPIRES = 0;
|
|
26
26
|
this.url = '';
|
|
27
|
+
this.timeoutCall = 0;
|
|
27
28
|
this.arrEvents = [];
|
|
28
29
|
this.logger = console;
|
|
29
30
|
this.isReadyVal = false;
|
|
@@ -112,6 +113,12 @@ class baseBX24 {
|
|
|
112
113
|
}
|
|
113
114
|
return encodeURIComponent(value);
|
|
114
115
|
}
|
|
116
|
+
setTimeoutCall(ms) {
|
|
117
|
+
this.timeoutCall = ms;
|
|
118
|
+
}
|
|
119
|
+
clearTimeoutCall() {
|
|
120
|
+
this.timeoutCall = 0;
|
|
121
|
+
}
|
|
115
122
|
isFunction(item) {
|
|
116
123
|
return item === null ? false : (typeof (item) == "function" || item instanceof Function);
|
|
117
124
|
}
|
|
@@ -204,6 +211,9 @@ class baseBX24 {
|
|
|
204
211
|
data: this.getHttpString(params),
|
|
205
212
|
url: url
|
|
206
213
|
};
|
|
214
|
+
if (this.timeoutCall) {
|
|
215
|
+
options.timeout = this.timeoutCall;
|
|
216
|
+
}
|
|
207
217
|
(0, axios_1.default)(options).then(res => {
|
|
208
218
|
const data = res.data;
|
|
209
219
|
const result = new callResult_1.CallResult(data, config, this, res.status);
|
package/dist/callResult.js
CHANGED
|
@@ -22,6 +22,8 @@ class CallResult {
|
|
|
22
22
|
}
|
|
23
23
|
error() {
|
|
24
24
|
var _a;
|
|
25
|
+
if (this.status !== 200 && this.status !== 201)
|
|
26
|
+
return `Incorect response: #${this.status}`;
|
|
25
27
|
return ((_a = this.answer) === null || _a === void 0 ? void 0 : _a.ex) || this.error_description();
|
|
26
28
|
}
|
|
27
29
|
error_description() {
|