@etsoo/appscript 1.5.2 → 1.5.3
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/lib/cjs/app/CoreApp.d.ts +0 -1
- package/lib/cjs/app/CoreApp.js +13 -8
- package/lib/mjs/app/CoreApp.d.ts +0 -1
- package/lib/mjs/app/CoreApp.js +13 -8
- package/package.json +1 -1
- package/src/app/CoreApp.ts +34 -9
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -152,7 +152,6 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
152
152
|
* @param name Application name
|
|
153
153
|
*/
|
|
154
154
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
155
|
-
private debugIt;
|
|
156
155
|
private getDeviceId;
|
|
157
156
|
private resetKeys;
|
|
158
157
|
/**
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -163,11 +163,6 @@ class CoreApp {
|
|
|
163
163
|
this.setup();
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
debugIt(...args) {
|
|
167
|
-
if (this.debug) {
|
|
168
|
-
console.debug('CoreApp', ...args);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
166
|
getDeviceId() {
|
|
172
167
|
return this.deviceId.substring(0, 15);
|
|
173
168
|
}
|
|
@@ -293,7 +288,9 @@ class CoreApp {
|
|
|
293
288
|
setApiErrorHandler(api, handlerFor401) {
|
|
294
289
|
api.onError = (error) => {
|
|
295
290
|
// Debug
|
|
296
|
-
this.
|
|
291
|
+
if (this.debug) {
|
|
292
|
+
console.debug('CoreApp.setApiErrorHandler', api, error, handlerFor401);
|
|
293
|
+
}
|
|
297
294
|
// Error code
|
|
298
295
|
const status = error.response
|
|
299
296
|
? api.transformResponse(error.response).status
|
|
@@ -333,7 +330,9 @@ class CoreApp {
|
|
|
333
330
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
334
331
|
api.onRequest = (data) => {
|
|
335
332
|
// Debug
|
|
336
|
-
this.
|
|
333
|
+
if (this.debug) {
|
|
334
|
+
console.debug('CoreApp.setApiLoading.onRequest', api, data, this.notifier.loadingCount);
|
|
335
|
+
}
|
|
337
336
|
if (data.showLoading == null || data.showLoading) {
|
|
338
337
|
this.notifier.showLoading();
|
|
339
338
|
}
|
|
@@ -341,9 +340,15 @@ class CoreApp {
|
|
|
341
340
|
// onComplete, hide loading, rewrite the property to override default action
|
|
342
341
|
api.onComplete = (data) => {
|
|
343
342
|
// Debug
|
|
344
|
-
this.
|
|
343
|
+
if (this.debug) {
|
|
344
|
+
console.debug('CoreApp.setApiLoading.onComplete', api, data, this.notifier.loadingCount, this.lastCalled);
|
|
345
|
+
}
|
|
345
346
|
if (data.showLoading == null || data.showLoading) {
|
|
346
347
|
this.notifier.hideLoading();
|
|
348
|
+
// Debug
|
|
349
|
+
if (this.debug) {
|
|
350
|
+
console.debug('CoreApp.setApiLoading.onComplete.showLoading', api, this.notifier.loadingCount);
|
|
351
|
+
}
|
|
347
352
|
}
|
|
348
353
|
this.lastCalled = true;
|
|
349
354
|
};
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -152,7 +152,6 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
152
152
|
* @param name Application name
|
|
153
153
|
*/
|
|
154
154
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
155
|
-
private debugIt;
|
|
156
155
|
private getDeviceId;
|
|
157
156
|
private resetKeys;
|
|
158
157
|
/**
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -160,11 +160,6 @@ export class CoreApp {
|
|
|
160
160
|
this.setup();
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
debugIt(...args) {
|
|
164
|
-
if (this.debug) {
|
|
165
|
-
console.debug('CoreApp', ...args);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
163
|
getDeviceId() {
|
|
169
164
|
return this.deviceId.substring(0, 15);
|
|
170
165
|
}
|
|
@@ -290,7 +285,9 @@ export class CoreApp {
|
|
|
290
285
|
setApiErrorHandler(api, handlerFor401) {
|
|
291
286
|
api.onError = (error) => {
|
|
292
287
|
// Debug
|
|
293
|
-
this.
|
|
288
|
+
if (this.debug) {
|
|
289
|
+
console.debug('CoreApp.setApiErrorHandler', api, error, handlerFor401);
|
|
290
|
+
}
|
|
294
291
|
// Error code
|
|
295
292
|
const status = error.response
|
|
296
293
|
? api.transformResponse(error.response).status
|
|
@@ -330,7 +327,9 @@ export class CoreApp {
|
|
|
330
327
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
331
328
|
api.onRequest = (data) => {
|
|
332
329
|
// Debug
|
|
333
|
-
this.
|
|
330
|
+
if (this.debug) {
|
|
331
|
+
console.debug('CoreApp.setApiLoading.onRequest', api, data, this.notifier.loadingCount);
|
|
332
|
+
}
|
|
334
333
|
if (data.showLoading == null || data.showLoading) {
|
|
335
334
|
this.notifier.showLoading();
|
|
336
335
|
}
|
|
@@ -338,9 +337,15 @@ export class CoreApp {
|
|
|
338
337
|
// onComplete, hide loading, rewrite the property to override default action
|
|
339
338
|
api.onComplete = (data) => {
|
|
340
339
|
// Debug
|
|
341
|
-
this.
|
|
340
|
+
if (this.debug) {
|
|
341
|
+
console.debug('CoreApp.setApiLoading.onComplete', api, data, this.notifier.loadingCount, this.lastCalled);
|
|
342
|
+
}
|
|
342
343
|
if (data.showLoading == null || data.showLoading) {
|
|
343
344
|
this.notifier.hideLoading();
|
|
345
|
+
// Debug
|
|
346
|
+
if (this.debug) {
|
|
347
|
+
console.debug('CoreApp.setApiLoading.onComplete.showLoading', api, this.notifier.loadingCount);
|
|
348
|
+
}
|
|
344
349
|
}
|
|
345
350
|
this.lastCalled = true;
|
|
346
351
|
};
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -319,12 +319,6 @@ export abstract class CoreApp<
|
|
|
319
319
|
);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
private debugIt(...args: any[]) {
|
|
323
|
-
if (this.debug) {
|
|
324
|
-
console.debug('CoreApp', ...args);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
322
|
private getDeviceId() {
|
|
329
323
|
return this.deviceId.substring(0, 15);
|
|
330
324
|
}
|
|
@@ -487,7 +481,14 @@ export abstract class CoreApp<
|
|
|
487
481
|
) {
|
|
488
482
|
api.onError = (error: ApiDataError) => {
|
|
489
483
|
// Debug
|
|
490
|
-
this.
|
|
484
|
+
if (this.debug) {
|
|
485
|
+
console.debug(
|
|
486
|
+
'CoreApp.setApiErrorHandler',
|
|
487
|
+
api,
|
|
488
|
+
error,
|
|
489
|
+
handlerFor401
|
|
490
|
+
);
|
|
491
|
+
}
|
|
491
492
|
|
|
492
493
|
// Error code
|
|
493
494
|
const status = error.response
|
|
@@ -529,7 +530,14 @@ export abstract class CoreApp<
|
|
|
529
530
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
530
531
|
api.onRequest = (data) => {
|
|
531
532
|
// Debug
|
|
532
|
-
this.
|
|
533
|
+
if (this.debug) {
|
|
534
|
+
console.debug(
|
|
535
|
+
'CoreApp.setApiLoading.onRequest',
|
|
536
|
+
api,
|
|
537
|
+
data,
|
|
538
|
+
this.notifier.loadingCount
|
|
539
|
+
);
|
|
540
|
+
}
|
|
533
541
|
|
|
534
542
|
if (data.showLoading == null || data.showLoading) {
|
|
535
543
|
this.notifier.showLoading();
|
|
@@ -539,10 +547,27 @@ export abstract class CoreApp<
|
|
|
539
547
|
// onComplete, hide loading, rewrite the property to override default action
|
|
540
548
|
api.onComplete = (data) => {
|
|
541
549
|
// Debug
|
|
542
|
-
this.
|
|
550
|
+
if (this.debug) {
|
|
551
|
+
console.debug(
|
|
552
|
+
'CoreApp.setApiLoading.onComplete',
|
|
553
|
+
api,
|
|
554
|
+
data,
|
|
555
|
+
this.notifier.loadingCount,
|
|
556
|
+
this.lastCalled
|
|
557
|
+
);
|
|
558
|
+
}
|
|
543
559
|
|
|
544
560
|
if (data.showLoading == null || data.showLoading) {
|
|
545
561
|
this.notifier.hideLoading();
|
|
562
|
+
|
|
563
|
+
// Debug
|
|
564
|
+
if (this.debug) {
|
|
565
|
+
console.debug(
|
|
566
|
+
'CoreApp.setApiLoading.onComplete.showLoading',
|
|
567
|
+
api,
|
|
568
|
+
this.notifier.loadingCount
|
|
569
|
+
);
|
|
570
|
+
}
|
|
546
571
|
}
|
|
547
572
|
this.lastCalled = true;
|
|
548
573
|
};
|