@textback/notification-widget
Version:
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
31 lines (25 loc) • 775 B
JavaScript
import { Observer, EVENTS } from '../events/observer.js';
export default class Channel {
constructor(channelData = {}, deeplink, widget) {
this.config = channelData;
this.channel = channelData.channel;
this.channelId = channelData.channelId;
this.enabled = channelData.enabled;
this.id = channelData.id;
this.slug = channelData.slug;
this.deeplink = deeplink;
this.widget = widget;
this.initPromise = null;
this.hasError = false;
}
subscribe() {
Observer.trigger(EVENTS.SUBSCRIBE_START, {
widgetId: this.widget.id,
channel: this,
});
}
reportError(...args) {
console.error(...args);
this.hasError = true;
}
}