Calls release(), for await using.
Hosts without Symbol.asyncDispose, such as ArkTS, leave it undefined.
Calls dispose(), for using.
Hosts without Symbol.dispose, such as ArkTS, leave it undefined.
ReadonlyidThe native handle value, which runtime events report as their source. It stays readable after release, so events drained later still match this handle.
The commands of this owner that discard their outcomes.
Whether a release, dispose, or discard has ended the handle.
Stops sending the events of the runtime and its maps to a callback.
See mln_runtime_clear_event_handler in the
C API reference.
Stops adding headers to the runtime's HTTP requests.
See mln_runtime_clear_http_header_transform in the
C API reference.
Removes the runtime's resource provider, so the library loads every request itself.
See mln_runtime_clear_resource_provider in the
C API reference.
Stops rewriting the URLs of the runtime's network requests.
See mln_runtime_clear_resource_transform in the
C API reference.
Creates a map on runtime.
Asynchronous calls on the map before the completion runs wait for it, and
complete with Status.invalidState when creation fails.
See mln_runtime_create_map in the
C API reference.
Creates an offline region in the runtime's cache file.
metadata holds any bytes to store with the region, such as its name. The
region doesn't download until
RuntimeHandle.setOfflineRegionDownloadState() makes its download active.
See mln_runtime_create_offline_region in the
C API reference.
Deletes the offline region regionId from the runtime's cache file.
See mln_runtime_delete_offline_region in the
C API reference.
Errors:
Status.notFound when the cache file has no region regionId.Releases a runtime in any state, without waiting.
The runtime finishes its teardown after its maps are released.
See mln_runtime_dispose in the
C API reference.
Reads the offline region regionId.
The result is null when the cache file has no region with that ID.
See mln_runtime_get_offline_region in the
C API reference.
Reads the download progress of the offline region regionId.
While the download is active, the counts cover what it has visited. Once it's inactive, they cover every resource the region holds, including those that only earlier versions of its style listed, so the completed counts can exceed the required counts.
See mln_runtime_get_offline_region_status in the
C API reference.
Errors:
Status.notFound when the cache file has no region regionId.Makes maps check each resource of the offline region regionId with the
server before they use it.
The region keeps its resources. Starting its download again fetches the invalidated resources for offline use. If the style or a TileJSON document is then missing or invalid, the download reports an offline region response error and goes on from the stored copy. Resources that the current style no longer lists stay in the region until it's deleted.
See mln_runtime_invalidate_offline_region in the
C API reference.
Errors:
Status.notFound when the cache file has no region regionId.Lists the offline regions in the runtime's cache file.
See mln_runtime_list_offline_regions in the
C API reference.
Copies the offline regions of another cache file into the runtime's cache file.
A region whose definition and metadata match one that the runtime's file already has isn't copied again. The result lists the runtime's copy of each region in the other file.
See mln_runtime_merge_offline_regions in the
C API reference.
Errors:
Status.invalidArgument when sideDatabasePath isn't a readable
database file.Status.nativeError when the merge would exceed the tile limit that
RuntimeEventType.offlineRegionTileCountLimitExceeded describes.Releases a runtime.
Release the runtime's maps first.
See mln_runtime_release in the
C API reference.
Runs a maintenance action on the runtime's cache database.
See mln_runtime_run_cache_database_operation in the
C API reference.
Sends the events of the runtime and its maps to a callback.
The callback replaces the one set before.
See mln_runtime_set_event_handler in the
C API reference.
Adds headers to the runtime's HTTP requests.
The transform replaces the one set before. In a browser or on OpenHarmony,
serve the requests with RuntimeHandle.setResourceProvider() instead.
See mln_runtime_set_http_header_transform in the
C API reference.
Errors:
Status.unsupported when the library runs in a browser or on
OpenHarmony.Limits the size of the runtime's ambient cache.
size is in bytes. Offline regions don't count toward it. It defaults to
50 MB, or to 0 in the browser when the runtime has no cache file.
See mln_runtime_set_maximum_ambient_cache_size in the
C API reference.
Starts or pauses the download of the offline region regionId.
Setting the state that the download already has does nothing. A download stops when the runtime closes.
See mln_runtime_set_offline_region_download_state in the
C API reference.
Errors:
Status.notFound when the cache file has no region regionId.Selects the events that the runtime reports about the download of the
offline region regionId.
events holds bits of RuntimeEventFlag.allRuntimeEvents and replaces the
region's previous selection. RuntimeEventFlag.none stops the region's
events.
See mln_runtime_set_offline_region_observed in the
C API reference.
Errors:
Status.notFound when the cache file has no region regionId.Serves the runtime's network requests through a callback.
The provider receives the network requests that its routes match, and the library loads the rest as usual. A provider can serve URL schemes that the library can't load itself. The provider replaces the one set before.
See mln_runtime_set_resource_provider in the
C API reference.
Rewrites the URLs of the runtime's network requests.
The transform replaces the one set before.
See mln_runtime_set_resource_transform in the
C API reference.
Names the owner's type, its handle ID, and whether it is closed.
Replaces the metadata of the offline region regionId.
See mln_runtime_update_offline_region_metadata in the
C API reference.
Errors:
Status.notFound when the cache file has no region regionId.StaticcreateCreates a runtime.
A runtime holds maps and the resource loading, cache, and offline regions that they share. In a browser, create runtimes on a Web Worker, not on the main thread.
Resolves once the call completes, so a browser page, which cannot block, can call it.
See mln_runtime_create in the
C API reference.
Errors:
Status.invalidArgument when the cache database file that options
names can't be opened or created.Optionaloptions: RuntimeOptions
A runtime owns maps and the network and cache settings that they share.
See
mln_runtimein the C API reference.