Exceptions and Errors are better Files structure is better New ComponentContext.ts New DataTable.tsx tables.ts Massive components refactoring New Group.java New LoggingRequestFilter.java LoggingSessionListener.java New NotificationStore.ts SysInfoStore.ts New reactiveValue.ts ReactiveControls.tsx New dependencies And much more
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import {NotificationStore} from "../store/NotificationStore";
|
|
|
|
export class NotificationService {
|
|
static store?: NotificationStore;
|
|
|
|
static init(store: NotificationStore) {
|
|
this.store = store;
|
|
console.debug('NotificationService initialized');
|
|
}
|
|
|
|
static error(message: string, title?: string) {
|
|
if (!this.store) {
|
|
console.log(`NotificationStore is not initialized\nMessage: ${message}\nTitle: ${title}`);
|
|
return;
|
|
}
|
|
this.store.error(message, title);
|
|
}
|
|
|
|
static warn(message: string, title?: string) {
|
|
if (!this.store) {
|
|
console.log(`NotificationStore is not initialized\nMessage: ${message}\nTitle: ${title}`);
|
|
return;
|
|
}
|
|
this.store.warn(message, title);
|
|
}
|
|
|
|
static info(message: string, title?: string) {
|
|
if (!this.store) {
|
|
console.log(`NotificationStore is not initialized\nMessage: ${message}\nTitle: ${title}`);
|
|
return;
|
|
}
|
|
this.store.info(message, title);
|
|
}
|
|
|
|
static success(message: string, title?: string) {
|
|
if (!this.store) {
|
|
console.log(`NotificationStore is not initialized\nMessage: ${message}\nTitle: ${title}`);
|
|
return;
|
|
}
|
|
this.store.success(message, title);
|
|
}
|
|
}
|