papi-dts
    Preparing search index...

    Interface CommandHandlers

    Function types for each command available on the papi. Each extension can extend this interface to add commands that it registers on the papi with papi.commands.registerCommand.

    Note: Command names must consist of two strings separated by at least one period. We recommend one period and lower camel case in case we expand the api in the future to allow dot notation.

    An extension can extend this interface to add types for the commands it registers by adding the following to its .d.ts file:

    declare module 'papi-shared-types' {
    export interface CommandHandlers {
    'myExtension.myCommand1': (foo: string, bar: number) => string;
    'myExtension.myCommand2': (foo: string) => Promise<void>;
    }
    }
    interface CommandHandlers {
        "platform.about": () => Promise<void>;
        "platform.closeOpenUsersnapForm": () => Promise<void>;
        "platform.getLogFileContent": () => Promise<string>;
        "platform.getOSPlatform": () => Promise<undefined | string>;
        "platform.goToNextBook": () => Promise<void>;
        "platform.goToNextChapter": () => Promise<void>;
        "platform.goToNextVerse": () => Promise<void>;
        "platform.goToPreviousBook": () => Promise<void>;
        "platform.goToPreviousChapter": () => Promise<void>;
        "platform.goToPreviousVerse": () => Promise<void>;
        "platform.isFullScreen": () => Promise<boolean>;
        "platform.isUsersnapFormCurrentlyOpen": () => Promise<boolean>;
        "platform.navigateLeftInReferenceHistory": () => Promise<boolean>;
        "platform.navigateRightInReferenceHistory": () => Promise<boolean>;
        "platform.openBookChapterControl": () => Promise<void>;
        "platform.openDeveloperDocumentationUrl": () => Promise<void>;
        "platform.openProjectSettings": (webViewId: string) => Promise<void>;
        "platform.openSettings": (webViewId?: string) => Promise<void>;
        "platform.openUserSettings": () => Promise<void>;
        "platform.openWindow": (url: string) => Promise<void>;
        "platform.quit": () => Promise<void>;
        "platform.restart": () => Promise<void>;
        "platform.restartExtensionHost": () => Promise<void>;
        "platform.usersnapReportIssue": () => Promise<void>;
        "platform.usersnapSubmitIdea": () => Promise<void>;
        "platform.zoomIn": () => Promise<void>;
        "platform.zoomOut": () => Promise<void>;
        "test.addMany": (...nums: number[]) => number;
        "test.echo": (message: string) => string;
        "test.echoExtensionHost": (message: string) => Promise<string>;
        "test.throwError": (message: string) => void;
        "test.throwErrorExtensionHost": (message: string) => void;
    }
    Index

    Properties

    "platform.about": () => Promise<void>

    Open a dialog that displays essential information about the application

    "platform.closeOpenUsersnapForm": () => Promise<void>

    Call close function for Usersnap forms known to the application

    "platform.getLogFileContent": () => Promise<string>

    Get the current log file content for debugging purposes

    "platform.getOSPlatform": () => Promise<undefined | string>

    Get the operating system platform

    "platform.goToNextBook": () => Promise<void>

    Navigate the active scroll group to the next book (chapter 1, verse 1)

    This command is unstable and may change or disappear without notice

    "platform.goToNextChapter": () => Promise<void>

    Navigate the active scroll group to the next chapter (rolls into the next book)

    This command is unstable and may change or disappear without notice

    "platform.goToNextVerse": () => Promise<void>

    Navigate the active scroll group to the next verse

    This command is unstable and may change or disappear without notice

    "platform.goToPreviousBook": () => Promise<void>

    Navigate the active scroll group to the previous book (chapter 1, verse 1)

    This command is unstable and may change or disappear without notice

    "platform.goToPreviousChapter": () => Promise<void>

    Navigate the active scroll group to the previous chapter (rolls into the previous book)

    This command is unstable and may change or disappear without notice

    "platform.goToPreviousVerse": () => Promise<void>

    Navigate the active scroll group to the previous verse

    This command is unstable and may change or disappear without notice

    "platform.isFullScreen": () => Promise<boolean>

    If the browser window is in full screen

    "platform.isUsersnapFormCurrentlyOpen": () => Promise<boolean>

    Check if a Usersnap form is currently open

    "platform.navigateLeftInReferenceHistory": () => Promise<boolean>

    Navigate the reference history in the physical "left" direction. Acts on the same scroll group the top toolbar follows (the active web view's scroll group), so a keyboard shortcut and the on-screen history buttons can never disagree. The renderer resolves the physical direction to a logical one for the current UI layout direction: left = back in LTR, forward in RTL (the pair swaps, physical-direction preserving). The main-process keyboard handler dispatches this directly so it never needs to know the UI direction or the active scroll group.

    Type declaration

      • (): Promise<boolean>
      • Returns Promise<boolean>

        true if navigation happened; false when there is no history in that direction or the active web view has no scroll group (a detached ref)

    "platform.navigateRightInReferenceHistory": () => Promise<boolean>

    Navigate the reference history in the physical "right" direction. Acts on the same scroll group the top toolbar follows (the active web view's scroll group), so a keyboard shortcut and the on-screen history buttons can never disagree. The renderer resolves the physical direction to a logical one for the current UI layout direction: right = forward in LTR, back in RTL (the pair swaps, physical-direction preserving). The main-process keyboard handler dispatches this directly so it never needs to know the UI direction or the active scroll group.

    Type declaration

      • (): Promise<boolean>
      • Returns Promise<boolean>

        true if navigation happened; false when there is no history in that direction or the active web view has no scroll group (a detached ref)

    "platform.openBookChapterControl": () => Promise<void>

    Open the appropriate Book Chapter Control (the active tab's if it shows one, else the top toolbar's) and focus its input, ready for typing a reference

    This command is unstable and may change or disappear without notice

    "platform.openDeveloperDocumentationUrl": () => Promise<void>

    Open a browser to the platform's OpenRPC documentation

    "platform.openProjectSettings": (webViewId: string) => Promise<void>

    3 December 2024. Renamed to platform.openSettings

    "platform.openSettings": (webViewId?: string) => Promise<void>
    "platform.openUserSettings": () => Promise<void>

    3 December 2024. Renamed to platform.openSettings

    "platform.openWindow": (url: string) => Promise<void>

    Open a link in a new browser window. Like window.open in the frontend with target='_blank' Consider using a visual indication along with this. E.g. for a menu download the https://lucide.dev/icons/external-link icon, add it to your extension's assets folder and use it like

    • "iconPathAfter": "papi-extension://<yourExtension>/assets/icons/external-link.svg". We plan to provide a common set of icons via an API in the future.

    For a button that opens external urls add

    • aria-label="{localizedStrings['%ariaLabel_opensInBrowser%']}"
    • Lucide icon <ExternalLink />
    "platform.quit": () => Promise<void>

    Shut down the application

    "platform.restart": () => Promise<void>

    Restart the application

    "platform.restartExtensionHost": () => Promise<void>
    "platform.usersnapReportIssue": () => Promise<void>

    Open Usersnap feedback form to report an issue

    "platform.usersnapSubmitIdea": () => Promise<void>

    Open Usersnap feedback form to submit an idea

    "platform.zoomIn": () => Promise<void>

    Increase the zoom level of the entire UI

    "platform.zoomOut": () => Promise<void>

    Decrease the zoom level of the entire UI

    "test.addMany": (...nums: number[]) => number
    "test.echo": (message: string) => string
    "test.echoExtensionHost": (message: string) => Promise<string>
    "test.throwError": (message: string) => void
    "test.throwErrorExtensionHost": (message: string) => void