UNPKG

@goongmaps/goong-map-react-native

Version:

A Goong GL react native module for creating custom maps

41 lines (31 loc) 776 B
import {NativeModules} from 'react-native'; const GoongSDKOfflineManager = NativeModules.MGLOfflineModule; class OfflinePack { constructor(pack) { this.pack = pack; this._metadata = null; } get name() { const {metadata} = this; return metadata && metadata.name; } get bounds() { return this.pack.bounds; } get metadata() { if (!this._metadata && this.pack.metadata) { this._metadata = JSON.parse(this.pack.metadata); } return this._metadata; } status() { return GoongSDKOfflineManager.getPackStatus(this.name); } resume() { return GoongSDKOfflineManager.resumePackDownload(this.name); } pause() { return GoongSDKOfflineManager.pausePackDownload(this.name); } } export default OfflinePack;