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.

854 B
Raw Blame
/**
 * NotebookNode messaging
 *
 * To help communication between nodes, you can register a message handler from any of the defined list.
 * Typing wise it is tricky to scope so all events handlers are typed as possibly undefined.
 */

export type NotebookNodeMessages = {
    'play-replay': {
        sessionRecordingId: string
        time: number
    }
    // Not used yet but as a future idea - you could "ping" a node to have it highlight or something.
    ping: {
        message: string
    }
}

export type NotebookNodeMessagesNames = keyof NotebookNodeMessages

export type NotebookNodeMessagesListener<MessageName extends NotebookNodeMessagesNames> = (
    e: NotebookNodeMessages[MessageName]
) => void

export type NotebookNodeMessagesListeners = {
    [MessageName in NotebookNodeMessagesNames]?: NotebookNodeMessagesListener<MessageName>
}