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

    Module index

    The low-level TypeScript binding for the MapLibre Native C API.

    The desktop binding supports Linux with glibc on Node.js, Bun, and Deno, Linux with musl on Node.js and Bun, and macOS and Windows on all three runtimes. The GNU RISC-V, LoongArch64, and FreeBSD x64 addons support Node.js.

    Windows backend packages use MSVC. To use a MinGW native host on x64, install @maplibre/native-ffi-opengl-mingw or @maplibre/native-ffi-vulkan-mingw instead of the ordinary backend package. Native handles shared with the host must come from the same C library DLL that the addon loads.

    Every callback reaches the realm's event loop after the native call that raised it has returned, so native code answers each synchronous decision itself. A provider or transform request arrives as an owner that the host answers later.

    Native code in the host can supply a wake or a queue lock as a native registration: Wake.native({ callback, userData, releaseUserData }) or QueueLock.native({ lock, unlock, userData, releaseUserData }), with each function pointer and the context as a bigint address. Native code calls a native wake directly, without a post to the realm. A queue lock has only this form, because native code relies on the lock being held when its callback returns. The first call that carries a native registration consumes it, and a later call throws a MaplibreError with the invalid-state status. Native code releases the context of a call that it accepts, and the binding calls the release for any other call.

    A pending binding Promise keeps the process alive, and a callback registration or a wake does not. To wait for a callback, call the wake member of an AwaitableWake from it and await next().

    Every 64-bit C integer, such as a generation, a timestamp, or a 64-bit mask, is a bigint, so it keeps its full range. JSON.stringify throws a TypeError on a bigint unless a replacer converts it.

    A JSON value is any value that JSON.stringify takes, typed unknown, so setStyleLayerProperty("roads", "line-color", "red") needs no inner quotes. In a parameter or a record member, undefined is absent, which native code reads as empty, and null is JSON null, such as the null that restores a layer property's default. A value that JSON.stringify rejects throws its error before the call reaches native code, and one that it skips, such as a function, throws a TypeError. Returned JSON is the value that JSON.parse reads, and absent JSON is undefined. JSON.parse reads every number as a number, so an integer above 2^53, such as some feature IDs, loses precision.

    A realm runs on one thread, so it can drive a caller-driven render session: make its context current on the JavaScript thread and call serviceDriverWork() when the driver-work wake arrives. A realm loads one copy of the binding.

    AbiVersionMismatchError
    AcquiredFrameHandle
    AwaitableWake
    FramePacerHandle
    MapHandle
    MapHandleDiscarding
    MaplibreError
    MapProjectionHandle
    OffscreenDeviceHandle
    RenderSessionHandle
    RenderSessionHandleDiscarding
    ResourceRequestHandle
    ResourceTransformRequestHandle
    RuntimeHandle
    RuntimeHandleDiscarding
    ScopedAndroidHardwareBufferFrame
    ScopedDmaBufFrame
    ScopedDxgiSharedTextureFrame
    ScopedGpuSync
    ScopedIoSurfaceFrame
    ScopedMetalTextureFrame
    ScopedOpenGlTextureFrame
    ScopedVulkanTextureFrame
    ScopedWebGpuTextureFrame
    StyleExpressionHandle
    VulkanDeviceHandle
    AnchoredMomentum
    AndroidHardwareBufferFrame
    AndroidHardwareBufferRingDescriptor
    AndroidSurfaceDescriptor
    AndroidSurfaceReplacement
    AnimationOptions
    AwaitableWakeOptions
    AwaitableWakeSignal
    BoundOptions
    Camera
    CameraBounds
    CameraDelta
    CameraFitOptions
    CameraFitUpdate
    CameraOptions
    CameraQueryResult
    CameraTransitionEnd
    CameraTransitionHandler
    CameraUpdate
    CameraVelocity
    CanonicalTileId
    CommandCompletion
    CustomGeometrySourceOptions
    CustomVectorSourceOptions
    DmaBufFormat
    DmaBufFrame
    DmaBufPlane
    DmaBufRingDescriptor
    DxgiSharedTextureFrame
    DxgiSharedTextureRingDescriptor
    EdgeInsets
    EglContextDescriptor
    FeatureStateSelector
    FrameDemand
    FramePacerOptions
    FreeCamera
    FreeCameraOptions
    GeoJsonSourceOptions
    GestureMomentum
    GpuSync
    HttpHeader
    HttpHeaderRule
    HttpHeaderTransform
    ImageContent
    ImageStretch
    IoSurfaceFrame
    IoSurfaceRingDescriptor
    LatLng
    LatLngBounds
    LogHandler
    LogicalExtent
    LogicalSize
    MapOptions
    MapProjectionCameraResult
    MapSnapshot
    MapTileOptions
    MapTileSettings
    MapView
    MapViewport
    MapViewportOptions
    MetalBorrowedTexture
    MetalBorrowedTextureDescriptor
    MetalBorrowedTextureReplacement
    MetalContextDescriptor
    MetalSurfaceDescriptor
    MetalSurfaceReplacement
    MetalTextureFrame
    MomentumDecay
    MomentumSnap
    NativeQueueLockFields
    NativeRegistration
    NativeWakeFields
    OfflineGeometryRegionDefinition
    OfflineRegionInfo
    OfflineRegionStatus
    OfflineTilePyramidRegionDefinition
    OffscreenDescriptor
    OffscreenDeviceOptions
    OhosSurfaceDescriptor
    OhosSurfaceReplacement
    OpenGlBorrowedTexture
    OpenGlBorrowedTextureDescriptor
    OpenGlBorrowedTextureReplacement
    OpenGlContextDescriptor
    OpenGlSurfaceDescriptor
    OpenGlSurfaceReplacement
    OpenGlTextureFrame
    PanMomentum
    PremultipliedRgba8Image
    ProjectedMeters
    ProjectionMode
    ProjectionModeOptions
    Quaternion
    RenderAbandonResult
    RenderedFeature
    RenderedFeatureQueryOptions
    RenderFrameResult
    RenderingStats
    RenderSessionAttachOptions
    RenderSessionCapabilities
    RenderSessionSnapshot
    ResourceProvider
    ResourceRange
    ResourceRequestCancelHandler
    ResourceRequestInfo
    ResourceResponse
    ResourceRoute
    ResourceTransform
    ResourceTransformError
    ResourceTransformRule
    RuntimeEvent
    RuntimeEventCameraChange
    RuntimeEventGlyphs
    RuntimeEventHandler
    RuntimeEventLoadingFailed
    RuntimeEventOfflineRegionResponseError
    RuntimeEventOfflineRegionStatus
    RuntimeEventOfflineRegionTileCountLimit
    RuntimeEventRenderFrame
    RuntimeEventSourceChanged
    RuntimeEventSprite
    RuntimeEventStyleImage
    RuntimeEventTileAction
    RuntimeOptions
    ScreenBox
    ScreenLineString
    ScreenPoint
    SourceFeature
    SourceFeatureQueryOptions
    StyleExpressionInfo
    StyleExpressionInputs
    StyleExpressionOptions
    StyleExpressionType
    StyleImageInfo
    StyleImageOptions
    StyleLayerInfo
    StyleSourceInfo
    StyleSourceTileInfo
    StyleTransitionOptions
    TextureImageInfo
    TextureReadbackResult
    TileId
    UnitBezier
    UrlQueryParameter
    Vec3
    VulkanBorrowedTexture
    VulkanBorrowedTextureDescriptor
    VulkanBorrowedTextureReplacement
    VulkanContextDescriptor
    VulkanDeviceContextResult
    VulkanDeviceOptions
    VulkanSurfaceDescriptor
    VulkanSurfaceReplacement
    VulkanTextureFrame
    WaylandSurfaceDescriptor
    WaylandSurfaceReplacement
    WebGlContextDescriptor
    WebGpuBorrowedTexture
    WebGpuBorrowedTextureDescriptor
    WebGpuBorrowedTextureReplacement
    WebGpuContextDescriptor
    WebGpuSurfaceDescriptor
    WebGpuSurfaceReplacement
    WebGpuTextureFrame
    WglContextDescriptor
    Win32WindowDescriptor
    Win32WindowReplacement
    CacheDatabaseOperation
    CameraChangeMode
    CameraChangeSource
    CameraTransitionOutcome
    CameraUpdateMode
    ConstrainMode
    FeatureId
    FrameDemandFlag
    GesturePhase
    GpuSyncKind
    GpuSyncKindFlag
    LogEvent
    LogSeverity
    LogSeverityFlag
    MapDebugFlag
    MapLoadError
    MapMode
    MomentumDecayModel
    NetworkStatus
    NorthOrientation
    OfflineRegionDefinition
    OfflineRegionDownloadState
    OpenGlClientApi
    OpenGlContextDescriptorData
    OpenGlContextOwnership
    OpenGlContextProviderFlag
    QueueLock
    RenderAbandonDisposition
    RenderBackendFlag
    RenderDriverKind
    RenderedQueryGeometry
    RenderMode
    RenderResult
    RenderSessionCapabilityFlag
    RenderSessionState
    ResourceErrorReason
    ResourceKind
    ResourceKindFlag
    ResourceLoadingMethod
    ResourcePriority
    ResourceResponseStatus
    ResourceStoragePolicy
    ResourceUsage
    RuntimeEventFlag
    RuntimeEventPayload
    RuntimeEventSourceType
    RuntimeEventType
    Status
    StyleExpressionTypeKind
    StyleImageTextFit
    StyleLayerVisibility
    StyleRasterDemEncoding
    StyleSourceType
    StyleTileScheme
    StyleVectorTileEncoding
    TileLodMode
    TileOperation
    UrlMatchFlag
    ViewportMode
    VulkanImageOwner
    Wake
    WebGlContextKind
    CacheDatabaseOperation
    CameraChangeMode
    CameraChangeSource
    CameraTransitionOutcome
    CameraUpdateMode
    ConstrainMode
    DIAGNOSTIC_MESSAGE_CAPACITY
    FRAME_DEMAND_TOKEN_STILL_IMAGE
    FrameDemandFlag
    GesturePhase
    GpuSyncKind
    GpuSyncKindFlag
    LogEvent
    LogSeverity
    LogSeverityFlag
    MapDebugFlag
    MapLoadError
    MapMode
    MomentumDecayModel
    NetworkStatus
    NorthOrientation
    OfflineRegionDownloadState
    OpenGlClientApi
    OpenGlContextOwnership
    OpenGlContextProviderFlag
    QueueLock
    RenderAbandonDisposition
    RenderBackendFlag
    RenderDriverKind
    RenderMode
    RenderResult
    RenderSessionCapabilityFlag
    RenderSessionState
    ResourceErrorReason
    ResourceKind
    ResourceKindFlag
    ResourceLoadingMethod
    ResourcePriority
    ResourceResponseStatus
    ResourceStoragePolicy
    ResourceUsage
    RuntimeEventFlag
    RuntimeEventSourceType
    RuntimeEventType
    Status
    StyleExpressionTypeKind
    StyleImageTextFit
    StyleLayerVisibility
    StyleRasterDemEncoding
    StyleSourceType
    StyleTileScheme
    StyleVectorTileEncoding
    TEXTURE_RING_MAX_DEPTH
    TileLodMode
    TileOperation
    UrlMatchFlag
    ViewportMode
    VULKAN_NON_DISPATCHABLE_HANDLE_NULL
    VulkanImageOwner
    Wake
    WebGlContextKind
    androidFramePacerCreate
    appleFramePacerCreate
    cameraForTile
    cameraToOptions
    clearLogCallback
    cVersion
    getNetworkStatus
    getPluginRegisterFunctionV1
    initAndroid
    latLngForProjectedMeters
    logicalExtentPhysicalSize
    ohosFramePacerCreate
    openGlSupportedContextProviderMask
    projectedMetersForLatLng
    setLogAsyncSeverityMask
    setLogCallback
    setNetworkStatus
    supportedRenderBackendMask