Skip to content

Commit

Permalink
Update docs from maps rnmapbox/maps@721de19
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 6, 2023
1 parent ad7fa2a commit 0052174
Showing 1 changed file with 139 additions and 0 deletions.
139 changes: 139 additions & 0 deletions docs/components/offlineManagerLegacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
custom_edit_url: https://github.com/rnmapbox/maps/blob/main/src/modules/offline/offlineManagerLegacy.ts
---
<!-- This file was autogenerated from offlineManagerLegacy.ts do not modify -->



```tsx
import { offlineManagerLegacy } from '@rnmapbox/maps';

offlineManagerLegacy

```
OfflineManagerLegacy implements a singleton (shared object) that manages offline packs.
All of this class’s instance methods are asynchronous, reflecting the fact that offline resources are stored in a database.
The shared object maintains a canonical collection of offline packs.



## methods
### createPack(options)

Creates and registers an offline pack that downloads the resources needed to use the given region offline.

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |
| `options` | `OfflineCreatePackOptions` | `Yes` | Create options for a offline pack that specifices zoom levels, style url, and the region to download. |



```javascript
await Mapbox.offlineManager.createPack({
name: 'offlinePack',
styleURL: 'mapbox://...',
minZoom: 14,
maxZoom: 20,
bounds: [[neLng, neLat], [swLng, swLat]]
})
```


### invalidatePack(name)

Invalidates the specified offline pack. This method checks that the tiles in the specified offline pack match those from the server. Local tiles that do not match the latest version on the server are updated.This is more efficient than deleting the offline pack and downloading it again. If the data stored locally matches that on the server, new data will not be downloaded.

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |
| `name` | `String` | `Yes` | Name of the offline pack. |



```javascript
await Mapbox.offlineManagerLegacy.invalidatePack('packName')
```


### deletePack(name)

Unregisters the given offline pack and allows resources that are no longer required by any remaining packs to be potentially freed.

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |
| `name` | `String` | `Yes` | Name of the offline pack. |



```javascript
await Mapbox.offlineManagerLegacy.deletePack('packName')
```


### migrateOfflineCache()

Migrates the offline cache from pre-v10 SDKs to the new v10 cache location

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |




```javascript
await Mapbox.offlineManager.migrateOfflineCache()
```


### resetDatabase()

Deletes the existing database, which includes both the ambient cache and offline packs, then reinitializes it.

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |




```javascript
await Mapbox.offlineManager.resetDatabase();
```


### getPacks()

Retrieves all the current offline packs that are stored in the database.

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |




```javascript
const offlinePacks = await Mapbox.offlineManagerLegacy.getPacks();
```


### getPack(name)

Retrieves an offline pack that is stored in the database by name.

#### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |
| `name` | `String` | `Yes` | Name of the offline pack. |



```javascript
const offlinePack = await Mapbox.offlineManagerLegacy.getPack();
```



0 comments on commit 0052174

Please sign in to comment.