Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

783 B
Raw Blame
import { requireOptionalNativeModule } from 'expo-modules-core'

interface HedgehogWidgetNativeModule {
    setChoreography(json: string): void
    clearChoreography(): void
}

const native = requireOptionalNativeModule<HedgehogWidgetNativeModule>('HedgehogWidget')

/** False on web and in any build without the native module, so callers can skip the sync. */
export function isAvailable(): boolean {
    return native !== null
}

/** Persists the choreography JSON where the widget reads it and refreshes every placed widget. */
export function setChoreography(json: string): void {
    native?.setChoreography(json)
}

/** Removes the stored choreography; widgets then play their built-in fallback. */
export function clearChoreography(): void {
    native?.clearChoreography()
}