Skip to content

Commit

Permalink
feat(lifecycle): add ionic 4 lifecycle snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjulian committed Jan 10, 2019
1 parent d0339f7 commit 89bc5a8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ Type part of a snippet, press enter, and the snippet unfolds.
| `i-on-will-dismiss-data` | Ionic `onWillDismiss` for dialogs returning data |
| `i-toast` | Ionic toast notification method |
| `i-toast-ctrl` | Ionic ToastController |
| `i-view-will-enter` | `ionViewWillEnter` (1st) - Fired when entering a page (also if it’s come back from stack), subscribe to `Observables` here or in `ionViewDidEnter` |
| `i-view-did-enter` | `ionViewDidEnter` (2nd) - Fired after entering (also if it’s come back from stack), subscribe to `Observables` here or in `ionViewWillEnter` |
| `i-view-will-leave` | `ionViewWillLeave` (3rd) - Fired if the page will leave (also if it’s keep in stack), cancel `Observables` here or in `ionViewDidLeave` |
| `i-view-did-leave` | `ionViewDidLeave` (4th) - Fired after the page was left (also if it’s keep in stack), cancel `Observables` here or in `ionViewWillLeave` |
| `i-view-will-unload` | `ionViewWillUnload` (5th) - In Angular not firing because here you have to use `ngOnDestroy` |
| `i-virtual-scroll-header-fn` | Ionic virtual scroll header function |

**[⬆ back to top](#overview)**
45 changes: 45 additions & 0 deletions snippets/typescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,51 @@
],
"description": "Ionic ToastController"
},
"ion-view-will-enter": {
"prefix": "i-view-will-enter",
"body": [
"ionViewWillEnter() {",
"\t$0",
"}"
],
"description": "ionViewWillEnter (1st) - Fired when entering a page (also if it’s come back from stack), subscribe to Observables here or in ionViewDidEnter"
},
"ion-view-did-enter": {
"prefix": "i-view-did-enter",
"body": [
"ionViewDidEnter() {",
"\t$0",
"}"
],
"description": "ionViewDidEnter (2nd) - Fired after entering (also if it’s come back from stack), subscribe to Observables here or in ionViewWillEnter"
},
"ion-view-will-leave": {
"prefix": "i-view-will-leave",
"body": [
"ionViewWillLeave() {",
"\t$0",
"}"
],
"description": "ionViewWillLeave (3rd) - Fired if the page will leave (also if it’s keep in stack), cancel Observables here or in ionViewDidLeave"
},
"ion-view-did-leave": {
"prefix": "i-view-did-leave",
"body": [
"ionViewDidLeave() {",
"\t$0",
"}"
],
"description": "ionViewDidLeave (4th) - Fired after the page was left (also if it’s keep in stack), cancel Observables here or in ionViewWillLeave"
},
"ion-view-will-unload": {
"prefix": "i-view-will-unload",
"body": [
"${1|ionViewWillUnload,ngOnDestroy|}() {",
"\t$0",
"}"
],
"description": "ionViewWillUnload (5th) - In Angular not firing because here you have to use ngOnDestroy"
},
"ion-virtual-scroll-header-fn": {
"prefix": "i-virtual-scroll-header-fn",
"body": [
Expand Down

0 comments on commit 89bc5a8

Please sign in to comment.