Skip to content

Commit 699417e

Browse files
committed
feat(plugins): add ngxs-reset-plugin and logger plugin
1 parent 18279b8 commit 699417e

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

integration/app/app.module.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { environment } from './../environments/environment';
12
import { CounterState } from './store/counter.state';
23
import { NgModule } from '@angular/core';
34
import { BrowserModule } from '@angular/platform-browser';
@@ -11,12 +12,15 @@ import { AppComponent } from './app.component';
1112
import { AppRoutingModule } from './app-routing.module';
1213
import { NgxsModule } from '@ngxs/store';
1314
import {
14-
NgxsAsyncStoragePluginModule,
15-
STORAGE_ENGINE
15+
NgxsAsyncStoragePluginModule
1616
} from '@ngxs-labs/async-storage-plugin';
1717
import { StorageService } from './services/storage.service';
1818
import { IonicStorageModule } from '@ionic/storage';
1919

20+
import { NgxsResetPluginModule } from 'ngxs-reset-plugin';
21+
22+
import { NgxsLoggerPluginModule } from '@ngxs/logger-plugin';
23+
2024
@NgModule({
2125
declarations: [AppComponent],
2226
entryComponents: [],
@@ -26,7 +30,9 @@ import { IonicStorageModule } from '@ionic/storage';
2630
AppRoutingModule,
2731
IonicStorageModule.forRoot(),
2832
NgxsModule.forRoot([CounterState]),
29-
NgxsAsyncStoragePluginModule.forRoot(StorageService)
33+
NgxsResetPluginModule.forRoot(),
34+
NgxsAsyncStoragePluginModule.forRoot(StorageService),
35+
NgxsLoggerPluginModule.forRoot({ disabled: environment.production })
3036
],
3137
providers: [
3238
StatusBar,
@@ -35,4 +41,4 @@ import { IonicStorageModule } from '@ionic/storage';
3541
],
3642
bootstrap: [AppComponent]
3743
})
38-
export class AppModule {}
44+
export class AppModule { }

integration/app/home/home.page.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
</ion-header>
88

99
<ion-content padding>
10-
<ng-container *ngIf="counter$ | async as counter">
11-
<h1>{{ counter }}</h1>
12-
</ng-container>
13-
14-
<ion-button (click)="increment()">Increment</ion-button>
15-
<ion-button (click)="decrement()">Decrement</ion-button>
16-
</ion-content>
10+
<ng-container *ngIf="counter$ | async as counter">
11+
<h1>{{ counter }}</h1>
12+
</ng-container>
13+
14+
<ion-button (click)="increment()">Increment</ion-button>
15+
<ion-button (click)="decrement()">Decrement</ion-button>
16+
17+
18+
<ion-button (click)="resetState()">
19+
Reset State
20+
</ion-button>
21+
</ion-content>

integration/app/home/home.page.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
22
import { Select, Store } from '@ngxs/store';
33
import { CounterState, Increment, Decrement } from '../store/counter.state';
44
import { Observable } from 'rxjs';
5+
import { StateResetAll } from 'ngxs-reset-plugin';
56

67
@Component({
78
selector: 'app-home',
@@ -12,7 +13,7 @@ export class HomePage {
1213
@Select(CounterState)
1314
public counter$: Observable<number>;
1415

15-
constructor(private store: Store) {}
16+
constructor(private store: Store) { }
1617

1718
increment() {
1819
this.store.dispatch(new Increment());
@@ -21,4 +22,8 @@ export class HomePage {
2122
decrement() {
2223
this.store.dispatch(new Decrement());
2324
}
25+
26+
resetState() {
27+
this.store.dispatch(new StateResetAll());
28+
}
2429
}

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@
5353
"@ionic-native/status-bar": "5.15.0",
5454
"@ionic/angular": "4.10.2",
5555
"@ionic/storage": "2.2.0",
56+
"@ngxs/logger-plugin": "3.5.1",
5657
"@ngxs/store": "3.5.1",
5758
"core-js": "2.6.6",
59+
"ngxs-reset-plugin": "1.2.0",
5860
"rxjs": "6.5.2",
5961
"zone.js": "0.8.26"
6062
},

0 commit comments

Comments
 (0)