@etsoo/appscript 1.1.68 → 1.1.69

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.
@@ -235,6 +235,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
235
235
  * @returns Result
236
236
  */
237
237
  hasPermission(roles: number | UserRole | number[] | UserRole[]): boolean;
238
+ /**
239
+ * Init call
240
+ * @param callback Callback
241
+ * @returns Result
242
+ */
243
+ initCall(callback?: (result: boolean) => void): Promise<void>;
238
244
  /**
239
245
  * Callback where exit a page
240
246
  */
@@ -387,9 +393,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
387
393
  protected setApi(api: IApi): void;
388
394
  /**
389
395
  * Init call
396
+ * @param callback Callback
390
397
  * @returns Result
391
398
  */
392
- protected initCall(): Promise<void>;
399
+ initCall(callback?: (result: boolean) => void): Promise<void>;
393
400
  /**
394
401
  * Init call update
395
402
  * @param data Result data
@@ -119,19 +119,25 @@ class CoreApp {
119
119
  }
120
120
  /**
121
121
  * Init call
122
+ * @param callback Callback
122
123
  * @returns Result
123
124
  */
124
- async initCall() {
125
+ async initCall(callback) {
125
126
  var _a;
126
127
  const data = {
127
128
  timestamp: new Date().getTime(),
128
129
  deviceId: this.deviceId === '' ? undefined : this.deviceId
129
130
  };
130
131
  const result = await this.api.put('Auth/WebInitCall', data);
131
- if (result == null)
132
+ if (result == null) {
133
+ if (callback)
134
+ callback(false);
132
135
  return;
136
+ }
133
137
  if (result.data == null) {
134
138
  this.notifier.alert(this.get('noData'));
139
+ if (callback)
140
+ callback(false);
135
141
  return;
136
142
  }
137
143
  if (!result.ok) {
@@ -146,9 +152,13 @@ class CoreApp {
146
152
  else {
147
153
  this.alertResult(result);
148
154
  }
155
+ if (callback)
156
+ callback(false);
149
157
  return;
150
158
  }
151
159
  this.initCallUpdate(result.data, data.timestamp);
160
+ if (callback)
161
+ callback(true);
152
162
  }
153
163
  /**
154
164
  * Init call update
@@ -235,6 +235,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
235
235
  * @returns Result
236
236
  */
237
237
  hasPermission(roles: number | UserRole | number[] | UserRole[]): boolean;
238
+ /**
239
+ * Init call
240
+ * @param callback Callback
241
+ * @returns Result
242
+ */
243
+ initCall(callback?: (result: boolean) => void): Promise<void>;
238
244
  /**
239
245
  * Callback where exit a page
240
246
  */
@@ -387,9 +393,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
387
393
  protected setApi(api: IApi): void;
388
394
  /**
389
395
  * Init call
396
+ * @param callback Callback
390
397
  * @returns Result
391
398
  */
392
- protected initCall(): Promise<void>;
399
+ initCall(callback?: (result: boolean) => void): Promise<void>;
393
400
  /**
394
401
  * Init call update
395
402
  * @param data Result data
@@ -116,19 +116,25 @@ export class CoreApp {
116
116
  }
117
117
  /**
118
118
  * Init call
119
+ * @param callback Callback
119
120
  * @returns Result
120
121
  */
121
- async initCall() {
122
+ async initCall(callback) {
122
123
  var _a;
123
124
  const data = {
124
125
  timestamp: new Date().getTime(),
125
126
  deviceId: this.deviceId === '' ? undefined : this.deviceId
126
127
  };
127
128
  const result = await this.api.put('Auth/WebInitCall', data);
128
- if (result == null)
129
+ if (result == null) {
130
+ if (callback)
131
+ callback(false);
129
132
  return;
133
+ }
130
134
  if (result.data == null) {
131
135
  this.notifier.alert(this.get('noData'));
136
+ if (callback)
137
+ callback(false);
132
138
  return;
133
139
  }
134
140
  if (!result.ok) {
@@ -143,9 +149,13 @@ export class CoreApp {
143
149
  else {
144
150
  this.alertResult(result);
145
151
  }
152
+ if (callback)
153
+ callback(false);
146
154
  return;
147
155
  }
148
156
  this.initCallUpdate(result.data, data.timestamp);
157
+ if (callback)
158
+ callback(true);
149
159
  }
150
160
  /**
151
161
  * Init call update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.1.68",
3
+ "version": "1.1.69",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -326,6 +326,13 @@ export interface ICoreApp<
326
326
  */
327
327
  hasPermission(roles: number | UserRole | number[] | UserRole[]): boolean;
328
328
 
329
+ /**
330
+ * Init call
331
+ * @param callback Callback
332
+ * @returns Result
333
+ */
334
+ initCall(callback?: (result: boolean) => void): Promise<void>;
335
+
329
336
  /**
330
337
  * Callback where exit a page
331
338
  */
@@ -588,9 +595,10 @@ export abstract class CoreApp<
588
595
 
589
596
  /**
590
597
  * Init call
598
+ * @param callback Callback
591
599
  * @returns Result
592
600
  */
593
- protected async initCall() {
601
+ async initCall(callback?: (result: boolean) => void) {
594
602
  const data: InitCallDto = {
595
603
  timestamp: new Date().getTime(),
596
604
  deviceId: this.deviceId === '' ? undefined : this.deviceId
@@ -599,10 +607,14 @@ export abstract class CoreApp<
599
607
  'Auth/WebInitCall',
600
608
  data
601
609
  );
602
- if (result == null) return;
610
+ if (result == null) {
611
+ if (callback) callback(false);
612
+ return;
613
+ }
603
614
 
604
615
  if (result.data == null) {
605
616
  this.notifier.alert(this.get<string>('noData')!);
617
+ if (callback) callback(false);
606
618
  return;
607
619
  }
608
620
 
@@ -623,10 +635,14 @@ export abstract class CoreApp<
623
635
  this.alertResult(result);
624
636
  }
625
637
 
638
+ if (callback) callback(false);
639
+
626
640
  return;
627
641
  }
628
642
 
629
643
  this.initCallUpdate(result.data, data.timestamp);
644
+
645
+ if (callback) callback(true);
630
646
  }
631
647
 
632
648
  /**