Last date modified: 2026-Jul-14

Conditionally Registering Extensions

You can use the viewer mode or the viewer version to conditionally load a Review Extension. Conditional loading is useful when an extension should only run in a particular context or is only compatible with certain versions of the Review Interface.

To conditionally register an extension, use the IExtensionParameters object passed to your extension script. It contains both version information (IVersionInformation) and the application context (ApplicationContext) that determines how the Review Interface is being displayed. To prevent your extension from loading, return undefined from your script.

Example

This example prevents the extension from loading when the document is displayed in the preview pane on the document list page:

Copy
import type { IExtensionParameters, IExtensionConfig } from 'reviewapi';

export default function(parameters: IExtensionParameters): IExtensionConfig | undefined {
  // Don't load in the document preview pane
  if (parameters.applicationContext === 'preview') {
    return undefined;
  }

  return {
    id: 'examplecompany.testextension',
    name: 'Example Company Test Extension',
    // ...
  };
}
Return to top of the page
Feedback