Skip to content

Commit 34fdce3

Browse files
committed
docs(vue): update existing code comment
1 parent 2414d2f commit 34fdce3

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

docs/vue/your-first-app/2-taking-photos.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ To define the data structure for our photo metadata, create a new interface name
111111

112112
```ts
113113
export const usePhotoGallery = () => {
114-
// Same old code from before.
114+
// ...existing code...
115115
};
116116

117117
// CHANGE: Add the `UserPhoto` interface.
@@ -128,7 +128,7 @@ export const usePhotoGallery = () => {
128128
// CHANGE: Add the `photos` array.
129129
const photos = ref<UserPhoto[]>([]);
130130

131-
// Same old code from before.
131+
// ...existing code...
132132
};
133133
```
134134

docs/vue/your-first-app/3-saving-photos.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
2424
import { Preferences } from '@capacitor/preferences';
2525

2626
export const usePhotoGallery = () => {
27-
// Same old code from before.
27+
// ...existing code...
2828

2929
// CHANGE: Add the `savePicture()` method.
3030
const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> => {
@@ -55,7 +55,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
5555
import { Preferences } from '@capacitor/preferences';
5656

5757
export const usePhotoGallery = () => {
58-
// Same old code from before.
58+
// ...existing code...
5959

6060
// CHANGE: Update the `addNewToGallery()` method.
6161
const addNewToGallery = async () => {
@@ -107,7 +107,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
107107
import { Preferences } from '@capacitor/preferences';
108108

109109
export const usePhotoGallery = () => {
110-
// Same old code from before.
110+
// ...existing code...
111111

112112
// CHANGE: Update the `savePicture()` method.
113113
const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> => {

docs/vue/your-first-app/4-loading-photos.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ export const usePhotoGallery = () => {
2626
// CHANGE: Add a key for photo storage.
2727
const PHOTO_STORAGE = 'photos';
2828

29-
// Same old code from before.
29+
// ...existing code...
3030
};
3131
```
3232

3333
Next, at the end of the `usePhotoGallery()` method, add a call to the `cachePhotos` method to save the `photos` array. By adding it here, the `photos` array is stored each time a new photo is taken. This way, it doesn’t matter when the app user closes or switches to a different app - all photo data is saved.
3434

3535
```ts
3636
export const usePhotoGallery = () => {
37-
// Same old code from before.
37+
// ...existing code...
3838

3939
// CHANGE: Add `cachePhotos()` method.
4040
const cachePhotos = () => {
@@ -57,7 +57,7 @@ Add the call to the `watch()` method above the return statement in `usePhotoGall
5757

5858
```ts
5959
export const usePhotoGallery = () => {
60-
// Same old code from before.
60+
// ...existing code...
6161

6262
// CHANGE: Add call to `watch` with `photos` array and `cachePhotos` method.
6363
watch(photos, cachePhotos);
@@ -73,7 +73,7 @@ With the photo array data saved, create a new method in the `usePhotoGallery()`
7373

7474
```ts
7575
export const usePhotoGallery = () => {
76-
// Same old code from before.
76+
// ...existing code...
7777

7878
// CHANGE: Add `loadSaved()` method.
7979
const loadSaved = async () => {
@@ -94,7 +94,7 @@ On mobile (coming up next!), we can directly set the source of an image tag - `<
9494

9595
```ts
9696
export const usePhotoGallery = () => {
97-
// Same old code from before.
97+
// ...existing code...
9898

9999
// CHANGE: Update `loadSaved()` method.
100100
const loadSaved = async () => {

docs/vue/your-first-app/5-adding-mobile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { Preferences } from '@capacitor/preferences';
3030
import { isPlatform } from '@ionic/vue';
3131
import { Capacitor } from '@capacitor/core';
3232

33-
// Same old code from before.
33+
// ...existing code...
3434
```
3535

3636
## Platform-specific Logic

docs/vue/your-first-app/7-live-reload.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import { isPlatform } from '@ionic/vue';
4646
import { Capacitor } from '@capacitor/core';
4747

4848
export const usePhotoGallery = () => {
49-
// Same old code from before.
49+
// ...existing code...
5050

5151
// CHANGE: Add `deletePhoto()` method.
5252
const deletePhoto = async (photo: UserPhoto) => {
@@ -81,7 +81,7 @@ export interface UserPhoto {
8181
Next, in `Tab2Page.vue`, implement the `showActionSheet()` method. We're adding two options: "Delete", which calls `usePhotoGallery.deletePicture()`, and "Cancel". The cancel button will automatically closes the action sheet when assigned the "cancel" role.
8282

8383
```vue
84-
<!-- Same old code from before. -->
84+
<!-- ...existing code... -->
8585
8686
<script setup lang="ts">
8787
import { camera, trash, close } from 'ionicons/icons';

versioned_docs/version-v7/vue/your-first-app/2-taking-photos.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ To define the data structure for our photo metadata, create a new interface name
111111

112112
```ts
113113
export const usePhotoGallery = () => {
114-
// Same old code from before.
114+
// ...existing code...
115115
};
116116

117117
// CHANGE: Add the `UserPhoto` interface.
@@ -128,7 +128,7 @@ export const usePhotoGallery = () => {
128128
// CHANGE: Add the `photos` array.
129129
const photos = ref<UserPhoto[]>([]);
130130

131-
// Same old code from before.
131+
// ...existing code...
132132
};
133133
```
134134

versioned_docs/version-v7/vue/your-first-app/3-saving-photos.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
2424
import { Preferences } from '@capacitor/preferences';
2525

2626
export const usePhotoGallery = () => {
27-
// Same old code from before.
27+
// ...existing code...
2828

2929
// CHANGE: Add the `savePicture()` method.
3030
const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> => {
@@ -55,7 +55,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
5555
import { Preferences } from '@capacitor/preferences';
5656

5757
export const usePhotoGallery = () => {
58-
// Same old code from before.
58+
// ...existing code...
5959

6060
// CHANGE: Update the `addNewToGallery()` method.
6161
const addNewToGallery = async () => {
@@ -107,7 +107,7 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
107107
import { Preferences } from '@capacitor/preferences';
108108

109109
export const usePhotoGallery = () => {
110-
// Same old code from before.
110+
// ...existing code...
111111

112112
// CHANGE: Update the `savePicture()` method.
113113
const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> => {

versioned_docs/version-v7/vue/your-first-app/4-loading-photos.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ export const usePhotoGallery = () => {
2626
// CHANGE: Add a key for photo storage.
2727
const PHOTO_STORAGE = 'photos';
2828

29-
// Same old code from before.
29+
// ...existing code...
3030
};
3131
```
3232

3333
Next, at the end of the `usePhotoGallery()` method, add a call to the `cachePhotos` method to save the `photos` array. By adding it here, the `photos` array is stored each time a new photo is taken. This way, it doesn’t matter when the app user closes or switches to a different app - all photo data is saved.
3434

3535
```ts
3636
export const usePhotoGallery = () => {
37-
// Same old code from before.
37+
// ...existing code...
3838

3939
// CHANGE: Add `cachePhotos()` method.
4040
const cachePhotos = () => {
@@ -57,7 +57,7 @@ Add the call to the `watch()` method above the return statement in `usePhotoGall
5757

5858
```ts
5959
export const usePhotoGallery = () => {
60-
// Same old code from before.
60+
// ...existing code...
6161

6262
// CHANGE: Add call to `watch` with `photos` array and `cachePhotos` method.
6363
watch(photos, cachePhotos);
@@ -73,7 +73,7 @@ With the photo array data saved, create a new method in the `usePhotoGallery()`
7373

7474
```ts
7575
export const usePhotoGallery = () => {
76-
// Same old code from before.
76+
// ...existing code...
7777

7878
// CHANGE: Add `loadSaved()` method.
7979
const loadSaved = async () => {
@@ -94,7 +94,7 @@ On mobile (coming up next!), we can directly set the source of an image tag - `<
9494

9595
```ts
9696
export const usePhotoGallery = () => {
97-
// Same old code from before.
97+
// ...existing code...
9898

9999
// CHANGE: Update `loadSaved()` method.
100100
const loadSaved = async () => {

versioned_docs/version-v7/vue/your-first-app/5-adding-mobile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { Preferences } from '@capacitor/preferences';
3030
import { isPlatform } from '@ionic/vue';
3131
import { Capacitor } from '@capacitor/core';
3232

33-
// Same old code from before.
33+
// ...existing code...
3434
```
3535

3636
## Platform-specific Logic

versioned_docs/version-v7/vue/your-first-app/7-live-reload.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import { isPlatform } from '@ionic/vue';
4646
import { Capacitor } from '@capacitor/core';
4747

4848
export const usePhotoGallery = () => {
49-
// Same old code from before.
49+
// ...existing code...
5050

5151
// CHANGE: Add `deletePhoto()` method.
5252
const deletePhoto = async (photo: UserPhoto) => {
@@ -81,7 +81,7 @@ export interface UserPhoto {
8181
Next, in `Tab2Page.vue`, implement the `showActionSheet()` method. We're adding two options: "Delete", which calls `usePhotoGallery.deletePicture()`, and "Cancel". The cancel button will automatically closes the action sheet when assigned the "cancel" role.
8282

8383
```vue
84-
<!-- Same old code from before. -->
84+
<!-- ...existing code... -->
8585
8686
<script setup lang="ts">
8787
import { camera, trash, close } from 'ionicons/icons';

0 commit comments

Comments
 (0)