Skip to content

Commit e5d342d

Browse files
committed
Adding ngrx snippets
1 parent 09955b5 commit e5d342d

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* cli-cheatsheet
1414
* nx-cheatsheet
1515
* nx-ngrx-cheatsheet
16+
* ngrx-action-creator
17+
* ngrx-action-creator-enum
1618

1719
## 5.2.x
1820
* ng-http-interceptor

Diff for: LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Mikael Morlund
3+
Copyright (c) 2016, 2017, 2018 Mikael Morlund
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ You don't need to type any dashes: "ngrxr" -> "ng-rx-reducer" snippet
231231
| ng-test-service | TODO |
232232
| ng-validator | Angular validator snippet |
233233
| ngrx-action-const | ngRx Single action |
234+
| ngrx-action-creator | ngRx Single action with const |
235+
| ngrx-action-creator-enum | ngRx Single action creator for enum |
234236
| ngrx-actions | ngRx Actions class |
235237
| ngrx-actiontype-enum | ngRx enum action type |
236238
| ngrx-actiontypes-enum | ngRx enum action types |

Diff for: snippets/typescript.json

+1-1
Large diffs are not rendered by default.

Diff for: src/snippets.json

+30-2
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@
916916
"/**",
917917
"\t* This function coerces a string into a string literal type.",
918918
" * Using tagged union types in TypeScript 2.0, this enables",
919-
" * powerful typechecking of our reducers.",
919+
" * powerful type checking of our reducers.",
920920
" * ",
921921
" * Since every action label passes through this function it",
922922
" * is a good place to ensure all of our action labels",
@@ -1044,7 +1044,35 @@
10441044
"description": "ngRx Single action",
10451045
"types": "typescript",
10461046
"body": [
1047-
"export const ${ACTION} = '${ACTION}';"
1047+
"export const ${ACTION} = '[${NameSpace}] ${ACTION}';",
1048+
"$0"
1049+
]
1050+
},
1051+
"Angular ngRx Action Creator": {
1052+
"prefix": "ngrx-action-creator",
1053+
"description": "ngRx Single action with const",
1054+
"types": "typescript",
1055+
"body": [
1056+
"export const ${ACTION} = '[${NameSpace}] ${ACTION}';",
1057+
"$0",
1058+
"export class ${Class} implements Action {",
1059+
"\treadonly type = ${ACTION};",
1060+
"",
1061+
"\tconstructor(public payload: ${payloadType}) { }",
1062+
"}",
1063+
""
1064+
]
1065+
},
1066+
"Angular ngRx Action Creator Enum": {
1067+
"prefix": "ngrx-action-creator-enum",
1068+
"description": "ngRx Single action creator for enum",
1069+
"types": "typescript",
1070+
"body": [
1071+
"export class ${Verb} implements Action {",
1072+
"\treadonly type = ${Class}ActionTypes.${Verb};",
1073+
"",
1074+
"\tconstructor(public payload: ${payloadType}) { }",
1075+
"}"
10481076
]
10491077
},
10501078
"Angular ngRx Enum ActionTypes": {

0 commit comments

Comments
 (0)