Skip to content

Commit

Permalink
feat(ngrx-commend): select data from another window store
Browse files Browse the repository at this point in the history
  • Loading branch information
meniRoy authored Oct 7, 2019
1 parent d5bad21 commit 2a35bca
Show file tree
Hide file tree
Showing 15 changed files with 409 additions and 128 deletions.
78 changes: 56 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"electron-mock-ipc": "^0.1.3",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",
"xxhashjs": "^0.2.2",
"zone.js": "~0.9.1"
},
"devDependencies": {
Expand Down
10 changes: 7 additions & 3 deletions projects/demo/src/app/counter/state/counter.reducer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { createReducer, on } from '@ngrx/store';
import { increment, decrement, reset } from './counter.actions';
import {createReducer, on} from '@ngrx/store';
import {increment, decrement, reset} from './counter.actions';
import {registerSelector} from 'electron-ngrx';

export const initialState = 0;

export const counterReducer = createReducer(initialState,
on(increment, state => state + 1),
on(decrement, state => state - 1),
on(reset, state => 0),
on(reset, () => 0),
);

export const selectCounter = (state) => state.count;
registerSelector(selectCounter);
4 changes: 2 additions & 2 deletions projects/demo/src/app/ipc/ipc.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<button (click)="sendToParent()">decrement on parent</button>
<br/>
<label>route<input [(ngModel)]="distWinRoute"></label>
<label>route<input [(ngModel)]="destinationWindRoute"></label>
<br/>
<button (click)="sendToRoute()">decrement on windows with route</button>
<br/>
<label>id<input [(ngModel)]="distWinId"></label>
<label>id<input [(ngModel)]="destinationWindId"></label>
<br/>
<button (click)="sendToId()">decrement on windows with id</button>
<br/>
Expand Down
Loading

0 comments on commit 2a35bca

Please sign in to comment.