@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
38 lines • 1.18 kB
JavaScript
import { NOTIFICATIONS } from "../../constants";
import { NotificationLevel } from "./notification-level";
/**
* Base class for real-time notification (browser notification) requests.
*/
export class RealtimeRequest {
constructor() {
this.notificationLevel = NotificationLevel.Info;
this.options = {};
}
getBody() {
if (this.options == null || !(NOTIFICATIONS.REALTIME.INFO.body in this.options)) {
return null;
}
const body = this.options[NOTIFICATIONS.REALTIME.INFO.body];
return body;
}
setBody(body) {
if (this.options == null) {
this.options = {};
}
this.options[NOTIFICATIONS.REALTIME.INFO.body] = body;
}
getIcon() {
if (this.options == null || !(NOTIFICATIONS.REALTIME.INFO.body in this.options)) {
return null;
}
const icon = this.options[NOTIFICATIONS.REALTIME.INFO.icon];
return icon;
}
setIcon(icon) {
if (this.options == null) {
this.options = {};
}
this.options[NOTIFICATIONS.REALTIME.INFO.icon] = icon;
}
}
//# sourceMappingURL=realtime-request.js.map