@maplibre/native-ffi
    Preparing search index...

    Class RuntimeHandle

    A runtime owns maps and the network and cache settings that they share.

    See mln_runtime in the C API reference.

    Hierarchy

    • Owner
      • RuntimeHandle
    Index
    "[asyncDispose]": () => Promise<void>

    Calls release(), for await using. Hosts without Symbol.asyncDispose, such as ArkTS, leave it undefined.

    "[dispose]": () => void

    Calls dispose(), for using. Hosts without Symbol.dispose, such as ArkTS, leave it undefined.

    id: bigint

    The native handle value, which runtime events report as their source. It stays readable after release, so events drained later still match this handle.

    • 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.

      Parameters

      • regionId: bigint

      Returns Promise<void>

    • 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.

      Parameters

      • regionId: bigint

      Returns Promise<OfflineRegionStatus>

    • 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.

      Parameters

      • regionId: bigint

      Returns Promise<void>

    • 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.

      Parameters

      • sideDatabasePath: string

      Returns Promise<readonly OfflineRegionInfo[]>

    • 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.

      Parameters

      • size: bigint

      Returns Promise<void>

    • 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.

      Parameters

      • regionId: bigint
      • events: bigint

      Returns Promise<void>

    • Creates 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.

      Parameters

      Returns Promise<RuntimeHandle>