@rws-framework/client 2.1.7 → 2.1.8
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/package.json
CHANGED
|
@@ -12,14 +12,14 @@ class NotifyServiceInstance extends TheService {
|
|
|
12
12
|
this.notifier = notifier;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public alert(message: string, logType: NotifyLogType = 'info', onConfirm?: (params: any) => void):
|
|
15
|
+
public alert(message: string, logType: NotifyLogType = 'info', onConfirm?: (params: any) => void, alertOptions?: any): any
|
|
16
16
|
{
|
|
17
17
|
if(!this.notifier){
|
|
18
18
|
console.warn('No notifier added to RWS Client');
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
this.notifier(message, logType, 'alert', onConfirm);
|
|
22
|
+
return this.notifier(message, logType, 'alert', onConfirm, alertOptions);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
public notify(message: string, logType: NotifyLogType = 'info', onConfirm?: (params: any) => void): void
|
|
@@ -135,6 +135,13 @@ class WSService extends TheService {
|
|
|
135
135
|
this.user = user;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
public listenForError<T extends Error | any = Error | any>(callback: (data: { error: T }) => void, method: string): void
|
|
139
|
+
{
|
|
140
|
+
this.socket().on(method, (rawData: string) => {
|
|
141
|
+
callback(JSON.parse(rawData));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
138
145
|
public listenForMessage(callback: (data: any, isJson?: boolean) => void, method?: string): () => void
|
|
139
146
|
{
|
|
140
147
|
const disableHandler = () => {
|
package/src/types/RWSNotify.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type NotifyUiType = 'alert' | 'notification' | 'silent';
|
|
2
2
|
type NotifyLogType = 'info' | 'error' | 'warning';
|
|
3
3
|
|
|
4
|
-
type RWSNotify = (message: string, logType?: NotifyLogType, uiType?: NotifyUiType, onConfirm?: (params?: any) => void) => any;
|
|
4
|
+
type RWSNotify = (message: string, logType?: NotifyLogType, uiType?: NotifyUiType, onConfirm?: (params?: any) => void, notifierOptions?: any) => any;
|
|
5
5
|
|
|
6
6
|
export default RWSNotify;
|
|
7
7
|
export { NotifyUiType, NotifyLogType };
|