Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4879d01

Browse files
fix:(effect) support v7 syntax
1 parent bb4c444 commit 4879d01

File tree

3 files changed

+64
-7
lines changed

3 files changed

+64
-7
lines changed

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<a name="9.1.0"></a>
2+
3+
## 9.1.0 (2020年07月04日)
4+
5+
* Reverted Typescript snippets for:
6+
* Effects and its setup to support [v7](https://v7.ngrx.io/guide/effects#writing-effects) style of using `@Effect()`
7+
18
<a name="9.0.0"></a>
29

310
## 9.0.0 (2020年07月04日)

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ Start typing `ngrx-*` and hit `enter`, the snippet spreads out.
3737
| ngrx-action | Action |
3838
| ngrx-action-success | Success Action |
3939
| ngrx-action-fail | Fail Action |
40-
| ngrx-effect-setup | Fully configured Effect using `createEffect` |
40+
| ngrx-effect-setup | Fully configured Effect |
4141
| ngrx-effect | Effect |
42+
| ngrx-create-effect-setup | Fully configured Effect using `createEffect` |
43+
| ngrx-create-effect | `createEffect` function |
4244
| ngrx-root-effect-registration | Effect Registration for root module |
4345
| ngrx-feat-effect-registration | Effect Registration for feature module |
4446
| ngrx-reducer | Reducer |

‎snippets/typescript.json‎

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@
174174
"}\n"
175175
]
176176
},
177-
"NgRx Effects Setup": {
178-
"prefix": "ngrx-effect-setup",
179-
"description": "NgRx effect setup",
177+
"NgRx Create Effect Setup": {
178+
"prefix": "ngrx-create-effect-setup",
179+
"description": "NgRx create effect setup",
180180
"body": [
181181
"import { Injectable } from '@angular/core';",
182182
"import { Actions, createEffect, ofType } from '@ngrx/effects';",
@@ -204,9 +204,9 @@
204204
"}"
205205
]
206206
},
207-
"NgRx Effect": {
208-
"prefix": "ngrx-effect",
209-
"description": "NgRx effect",
207+
"NgRx Create Effect": {
208+
"prefix": "ngrx-create-effect",
209+
"description": "NgRx create effect",
210210
"body": [
211211
"${1:effectName}$ = createEffect(() =>",
212212
"\tthis.actions$.pipe(",
@@ -221,6 +221,54 @@
221221
");"
222222
]
223223
},
224+
"NgRx Effects Setup": {
225+
"prefix": "ngrx-effect-setup",
226+
"description": "NgRx effect setup",
227+
"body": [
228+
"import { Injectable } from '@angular/core';",
229+
"import { Actions, Effect, ofType } from '@ngrx/effects';",
230+
"",
231+
"// import { of } from 'rxjs';",
232+
"import { catchError, map, switchMap } from 'rxjs/operators';",
233+
"",
234+
"import * as ${2:alias} from '${1:actions}';",
235+
"//import all requried services or any dependencies",
236+
"",
237+
"@Injectable()",
238+
"export class ${3:Name}Effects {",
239+
"\tconstructor(private action$: Actions) { }",
240+
"",
241+
"\t@Effect()",
242+
"\t${4:effectName}$ = this.action$.pipe(",
243+
"\t\tofType(${2}${5:ACTION_TYPE}),",
244+
"\t\tswitchMap(() => {",
245+
"\t\t\t/*return this.myService().pipe(",
246+
"\t\t\t\tmap(data => data),",
247+
"\t\t\t\tcatchError(error => of(error))",
248+
"\t\t\t\t//dispatch action with payload in `map`",
249+
"\t\t\t\t//dispatch action with error in `catchError`",
250+
"\t\t\t);*/",
251+
"\t\t})",
252+
"\t);",
253+
"}"
254+
]
255+
},
256+
"NgRx Effect": {
257+
"prefix": "ngrx-effect",
258+
"description": "NgRx effect",
259+
"body": [
260+
"@Effect()",
261+
"${1:effectName}$ = this.action$.pipe(",
262+
"\tofType(${2:ACTION_TYPE}),",
263+
"\tswitchMap(() => {",
264+
"\t\t/*return this.myService().pipe(",
265+
"\t\t\tmap(data => data),",
266+
"\t\t\tcatchError(error => error)",
267+
"\t\t);*/",
268+
"\t})",
269+
");"
270+
]
271+
},
224272
"NgRx Root Effect Registration": {
225273
"prefix": "ngrx-root-effect-registration",
226274
"description": "NgRx Root Effect Registration.\nimport { EffectsModule } from '@ngrx/effects';",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /