-
Notifications
You must be signed in to change notification settings - Fork 0
/
weather-store.ts
31 lines (28 loc) · 1.06 KB
/
weather-store.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Injectable } from '@angular/core';
import { mixInInjectableSuperclass } from '@s-libs/ng-core';
import { PersistentStore } from '@s-libs/signal-store';
import { logToReduxDevtoolsExtension } from 'app/to-replace/js-core/redux/log-to-redux-devtools-extension';
import { EventTrackingService } from 'app/to-replace/mixpanel-core/event-tracking.service';
import { UpgradeService } from 'app/upgrade/upgrade.service';
import { WeatherState } from './weather-state';
@Injectable({ providedIn: 'root' })
export class WeatherStore extends mixInInjectableSuperclass(
PersistentStore,
)<WeatherState> {
constructor(
eventTrackingService: EventTrackingService,
upgradeService: UpgradeService,
) {
const freshState = new WeatherState();
super('weather', freshState, { migrator: upgradeService });
if (this.state === freshState) {
eventTrackingService.track('initialize_fresh_state', {
category: 'initialization',
});
}
logToReduxDevtoolsExtension(() => this.state, {
name: 'WeatherStore',
autoPause: true,
});
}
}