@towns-protocol/sdk
Version:
For more details, visit the following resources:
32 lines • 827 B
JavaScript
import { Observable } from '../../observable/observable';
export class NotificationSettings extends Observable {
constructor() {
super({
fetchedAtMs: undefined,
settings: undefined,
error: undefined,
});
}
initializeSettings(settings) {
this.set((_prev) => ({
fetchedAtMs: undefined,
settings,
error: undefined,
}));
}
updateSettings(settings, fetchedAtMs) {
this.set((prev) => ({
...prev,
fetchedAtMs: fetchedAtMs ?? prev.fetchedAtMs,
error: undefined,
settings,
}));
}
updateError(error) {
this.set((prev) => ({
...prev,
error,
}));
}
}
//# sourceMappingURL=notificationSettings.js.map