You can configure extensions to execute custom code at specific application lifecycle events. Your code has access to the full IReviewInterfaceApi when executing.
This page contains the following information:
To execute custom code in an extension, the extension script should return an IExtensionConfig object that contains the lifecycle
property. This property defines the custom code that runs when specific application lifecycle events fire.
The following is an example:
(function (parameters) {
var config = {
name: "Custom Code Example Extension",
id: "relativity.examples.customcode",
lifecycle: {
ready: function (api) {
console.log("The application is ready.");
// Your custom code has access to the full API here.
},
},
};
return config;
})(params);
For functional and performance reasons, choose the appropriate lifecycle event when writing your extension. See IExtensionLifecycle for lifecycle event reference content.
Note: Each lifecycle event handler is passed the public IReviewInterfaceApi as a parameter, which provides your custom code with full access to the API.
The following table lists the application lifecycle events that you can subscribe to:
Event name | Description |
---|---|
apiready |
The function invoked when the application is bootstrapping and the public IReviewInterfaceApi is ready for use. |
ready |
The function invoked when application startup is complete, and a document is presented to the user. |
activated |
The function invoked when the application is activated, and the user can interact with it. |
canDeactivate |
The function that is invoked just prior to application deactivation to determine if it is safe to deactivate the application |
deactivated |
The function that is invoked when the application is deactivated, and the user can no longer interact with it. |
canTeardown |
The function invoked immediately prior to the application being torn down. It determines whether it is safe to tear down the application. |
teardown |
The function invoked when the application teardown is approved, and the application is to be unloaded from memory. |