Options
All
  • Public
  • Public/Protected
  • All
Menu

Accessing the Relativity Review API

Review the following information about how to determine if the Review APIs are available, how to invoke the APIs, and how to listen for events.

This page contains the following information:

See these related pages:

Relativity Review API availability

After the Relativity Review viewer is loaded, the following APIs are available:

  • window.top.hydroImageApi - This API is available when the Relativity Review image viewer is loaded.
  • window.top.hydroProductionApi - This API is available when the Relativity Review production viewer is loaded.

Note: The Relativity Review API is also available on the window object in the frame hosting the viewer as window.review.

Verify that Relativity Review is enabled

After selecting the image or production viewer, run the following commands to verify that the Relativity Review viewers are enabled:

  • Image viewer

    documentViewer.useHydroViewerRightNow(2);
  • Production viewer

    documentViewer.useHydroViewerRightNow(4);

Listen for ready events

After the Review Interface loads, it raises the following events:

The following code sample illustrates how to listen for these events:

var myEventName = "apiready"; // Or use "ready".
var myEventHandler = function() {
    // Do something.
};
review.on(myEventName, myEventHandler);

The review property should be available on the page when you invoke your JavaScript. If it isn't available, the following code sample illustrates how to invoke the API:

function waitForReviewApi(handler) {
    if (window.review) {
        // If the API is available, invoke the passed in handler.
        handler();
    } else {
        // Otherwise, wait 50 ms for API to become available.
        setTimeout(function() {
            waitForReviewApi(handler);
        }, 50);
    }
}

waitForReviewApi(function() {
    // Do something that requires window.review here.
});