Skip to content

Commit

Permalink
fix: typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Jan 7, 2022
1 parent 31b89a9 commit 26d42ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ download new version from url, it should be a zip file, with files inside or wit
### set(...)

```typescript
set(options: { version: string; versionName; }) => Promise<void>
set(options: { version: string; versionName?: string; }) => Promise<void>
```

set version as current version, set will return error if there are no index.html file inside the version folder, versionName is optional and it's a custom value who will be saved for you

| Param | Type |
| ------------- | --------------------------------------------------- |
| **`options`** | <code>{ version: string; versionName: any; }</code> |
| Param | Type |
| ------------- | ------------------------------------------------------- |
| **`options`** | <code>{ version: string; versionName?: string; }</code> |

--------------------

Expand Down
2 changes: 1 addition & 1 deletion src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface CapacitorUpdaterPlugin {
* @returns {Promise<void>} an empty Promise when the version is set, if there are no index.html or no version folder throw an error
* @param version The version name to set as current version
*/
set(options: { version: string, versionName }): Promise<void>;
set(options: { version: string, versionName?: string }): Promise<void>;
/**
* delete version in storage
* @returns {Promise<void>} an empty Promise when the version is delete, otherwise throw an error
Expand Down
10 changes: 9 additions & 1 deletion src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class CapacitorUpdaterWeb
console.log('Cannot download version in web', options);
return { version: ""};
}
async set(options: { version: string }): Promise<void> {
async set(options: { version: string, versionName?: string }): Promise<void> {
console.log('Cannot set version in web', options);
}
async delete(options: { version: string }): Promise<void> {
Expand All @@ -26,4 +26,12 @@ export class CapacitorUpdaterWeb
console.log('Cannot get current version in web');
return { current: 'default'};
}
async reload(): Promise<void> {
console.log('Cannot reload current version in web');
return;
}
async versionName(): Promise<{ versionName: string }> {
console.log('Cannot get current versionName in web');
return { versionName: 'default'};
}
}

0 comments on commit 26d42ad

Please sign in to comment.