Skip to content

Commit ef100da

Browse files
committed
feat(typescript): add new typescript snippets
1 parent 54a4820 commit ef100da

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

Diff for: README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ Type part of a snippet, press enter, and the snippet unfolds.
135135
| `i-alert` | Ionic alert dialog method |
136136
| `i-alert-confirm` | Ionic alert confirm dialog method |
137137
| `i-alert-ctrl` | Ionic AlertController |
138+
| `i-ctrl-import` | Imports from `@ionic/angular` package |
138139
| `i-form` | Simple form group |
139140
| `i-form-builder` | FormBuilder |
140141
| `i-form-group` | FormGroup instance |
141142
| `i-form-value` | Get value for formControlName `form.get('email')` |
142-
| `i-ctrl-import` | Imports from `@ionic/angular` package |
143+
| `i-infinite-scroll-load-data` | Method to load more data with `complete` and `disabled` call |
144+
| `i-infinite-scroll-toggle` | Method to toggle `disabled` of InfiniteScroll |
145+
| `i-infinite-scroll-viewchild` | Viewchild for InfiniteScroll |
143146
| `i-modal` | Ionic modal dialog method |
144147
| `i-modal-ctrl` | Ionic ModalController |
145148
| `i-popover` | Ionic popover dialog method |

Diff for: snippets/typescript.json

+31
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,37 @@
134134
],
135135
"description": "Imports from @ionic/angular package"
136136
},
137+
"ion-infinite-scroll-load-data": {
138+
"prefix": "i-infinite-scroll-load-data",
139+
"body": [
140+
"${1:loadData}(event) {",
141+
"\tsetTimeout(() => {",
142+
"\t\tevent.target.complete();",
143+
"\t\t",
144+
"\t\tif (data.length == 1000) {",
145+
"\t\t\tevent.target.disabled = true;",
146+
"\t\t}",
147+
"\t}, 500);",
148+
"}"
149+
],
150+
"description": "Method to load more data with `complete` and `disabled` call"
151+
},
152+
"ion-infinite-scroll-toggle": {
153+
"prefix": "i-infinite-scroll-toggle",
154+
"body": [
155+
"${1:toggleInfiniteScroll}() {",
156+
"\t${2:infiniteScroll}.disabled = !${2:infiniteScroll}.disabled;",
157+
"}"
158+
],
159+
"description": "Method to toggle InfiniteScroll"
160+
},
161+
"ion-infinite-scroll-viewchild": {
162+
"prefix": "i-infinite-scroll-viewchild",
163+
"body": [
164+
"@ViewChild(InfiniteScroll) ${1:infiniteScroll}: InfiniteScroll;"
165+
],
166+
"description": "Viewchild for InfiniteScroll"
167+
},
137168
"modal": {
138169
"prefix": "i-modal",
139170
"body": [

0 commit comments

Comments
 (0)