# @capacitor/live-updates

Official Live Updates plugin for Capacitor

## Install

```bash
npm install @capacitor/live-updates
npx cap sync
```

## API

<docgen-index>

* [`sync()`](#sync)
* [`setConfig(...)`](#setconfig)
* [`getConfig()`](#getconfig)
* [`resetConfig()`](#resetconfig)
* [`reload()`](#reload)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### sync(...)

```typescript
sync(progress: ((percentage: number) => void) | undefined = undefined) => Promise<SyncResult>
```

Sync the app with Live Updates. Optionally takes a progress callback.

**Returns:** <code>Promise&lt;<a href="#syncresult">SyncResult</a>&gt;</code>

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


### setConfig(...)

```typescript
setConfig(config: LiveUpdateConfig) => Promise<void>
```

| Param        | Type                                                          |
| ------------ | ------------------------------------------------------------- |
| **`config`** | <code><a href="#liveupdateconfig">LiveUpdateConfig</a></code> |

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


### getConfig()

```typescript
getConfig() => Promise<LiveUpdateConfig>
```
**Returns:** <code>Promise&lt;<a href="#liveupdateconfig">LiveUpdateConfig</a>&gt;</code>

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


### resetConfig()

```typescript
resetConfig() => Promise<void>
```

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


### reload()

```typescript
reload() => Promise<void>
```

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


### Interfaces


#### SyncResult

| Prop                               | Type                                                  |
| ---------------------------------- | ----------------------------------------------------- |
| **`liveUpdate`**                   | <code><a href="#liveupdate">LiveUpdate</a></code>     |
| **`snapshot`**                     | <code><a href="#snapshot">Snapshot</a> \| null</code> |
| **`source`**                       | <code>'download' \| 'cache'</code>                    |
| **`activeApplicationPathChanged`** | <code>boolean</code>                                  |


#### LiveUpdate

| Prop          | Type                |
| ------------- | ------------------- |
| **`appId`**   | <code>string</code> |
| **`channel`** | <code>string</code> |


#### Snapshot

| Prop          | Type                |
| ------------- | ------------------- |
| **`id`**      | <code>string</code> |
| **`buildId`** | <code>string</code> |


#### LiveUpdateError

| Prop           | Type                                                                                         |
| -------------- | -------------------------------------------------------------------------------------------- |
| **`appId`**    | <code>string</code>                                                                          |
| **`failStep`** | <code>'CHECK' \| 'DOWNLOAD' \| 'COPY' \| 'UNPACK' \| 'VERIFY' \| 'UPDATE' \| 'CANCEL'</code> |
| **`message`**  | <code>string</code>                                                                          |


#### LiveUpdateConfig

| Prop                   | Type                                                          |
| ---------------------- | ------------------------------------------------------------- |
| **`appId`**            | <code>string</code>                                           |
| **`channel`**          | <code>string</code>                                           |
| **`autoUpdateMethod`** | <code><a href="#autoupdatemethod">AutoUpdateMethod</a></code> |
| **`maxVersions`**      | <code>number</code>                                           |
| **`key`**              | <code>string</code>                                           |


### Type Aliases


#### LiveUpdateResult

<code><a href="#syncresult">SyncResult</a> | <a href="#liveupdateerror">LiveUpdateError</a></code>


#### AutoUpdateMethod

<code>'none' | 'background'</code>


#### LiveUpdateConfig

<code><a href="#partial">Partial</a>&lt;<a href="#liveupdate">LiveUpdate</a>&gt; & { autoUpdateMethod?: 'none' | 'background'; strategy?: 'zip' | 'differential'; enabled?: boolean; maxVersions?: number; }</code>


#### Partial

Make all properties in T optional

<code>{ [P in keyof T]?: T[P]; }</code>

</docgen-api>
