Home > @magiclane/maps-sdk > ContentStoreItem

ContentStoreItem class

A single downloadable content product managed by the ContentStore.

This class models one content product (for example: a map/region, style, or voice pack). Do not construct instances directly; obtain items from the public ContentStore API.

The object exposes identification and localized display text, content type and language, size and downloaded-size metrics, availability/status and progress indicators, preview imagery, additional content-specific parameters and update metadata (version and update size).

Use this object to start/pause/cancel downloads, query state, access previews and delete local content.

Content

Signature:

export declare class ContentStoreItem 

Constructors

Constructor

Modifiers

Description

(constructor)(id)

Constructs a new instance of the ContentStoreItem class

Properties

Property

Modifiers

Type

Description

availableSize

readonly

number

Gets the available size of the content in bytes.

canDeleteContent

readonly

boolean

Returns true if the associated content can be deleted.

chapterName

readonly

string

Get the product chapter name translated to interface language.

Relevant for ContentType.roadMap items, where large countries are split in multiple downloadable pieces. All items from the same chapter share the same chapter name. The value is empty when the item is not a road map item or when the country is not split.

clientVersion

readonly

Version

Gets the client version of the content (local downloaded version).

contentParameters

readonly

SearchableParameterList

Gets additional parameters for the content item.

countryCodes

readonly

string[]

Get the country code (ISO 3166-1 alpha-3) list of the product as text.

The list is empty for non-road-map products.

downloadProgress

readonly

number

Gets the current download progress (0..100).

fileName

readonly

string

Get the full path to the local content data file when available.

Not downloaded content returns an empty string.

id

readonly

number

Get the unique id of the item in the content store.

imgPreview

readonly

Img

Gets the item image preview as an Img object. Caller must check validity.

isCompleted

readonly

boolean

Returns true if the item is completely downloaded.

isImagePreviewAvailable

readonly

boolean

Returns true if an image preview is available for this item.

isUpdatable

readonly

boolean

Returns true if the item is updatable (has a newer version available).

language

readonly

Language

Get the language of the product.

The returned Language may be null if the product has no associated language.

name

readonly

string

Get the name of the associated product.

The name is automatically translated based on the SDK settings language.

pointerId

readonly

any

Returns the internal pointer id for this item.

progressListener

readonly

any

Gets the current progress listener for this item, or null if not set.

status

readonly

ContentStoreItemStatus

Gets the current item status as a ContentStoreItemStatus value.

totalSize

readonly

number

Gets the size of the content in bytes.

type

readonly

any

Get the content type of the product.

updateItem

readonly

ContentStoreItem | null

Gets the corresponding update item if an update is in progress, or null.

updateSize

readonly

number

Gets the update size in bytes if an update is available for this item.

updateVersion

readonly

Version

Gets the update version if an update is available for this item.

Methods

Method

Modifiers

Description

asyncDownload(onCompleteCallback, options)

Asynchronously starts or resumes the download of the content store product content. Requires automatic map rendering. Disables the cursor if enabled.

cancelDownload()

Cancels a previous download operation. Partially downloaded content is deleted.

deleteContent()

Deletes the associated content. Operation is immediate; no notifications are triggered.

dispose()

Releases native resources associated with this object.

getImagePreview(size, format, allowResize)

Gets a binary image preview if available. Returns null if not available.

init(id)

static

pauseDownload(onComplete)

Pauses a previous download operation. Optionally provide an onComplete callback. Returns GemError.success on success, otherwise see GemError for other values.

setProgressListener(listener)

Sets a progress listener for this item.