-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs from maps rnmapbox/maps@721de19
- Loading branch information
1 parent
ad7fa2a
commit 0052174
Showing
1 changed file
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
``` | ||
|
||
|
||
|