How to Use UI Events Framework
To expose an API in the UI Events Framework, here are the general steps to follow:
Prerequisites
- Load the external application in the Service Center using the
oj-cx-svc-common-ui-events-container
component. - Load UI Events Framework library file in external application's HTML or DOM file.
Overview of the Steps
- Initialize the framework.
- Get the required context for the use case.
- Generate request object using requestHelper.
- Invoke the APIS exposed in the above contexts.
Initialize UI Events Framework
Now you initialize the framework using an application name for any interaction. Once
the framework is initialized successfully, you can get the reference to the instance
of IUiEventsFrameworkProvider
. All the interactions happening from
this object can be tracked with the application name provided during the
initialization.
initialize(applicationId: string, version?: string): Promise<IUiEventsFrameworkProvider>;
Parameters
Parameter Name | Required | Description |
---|---|---|
applicationId | Yes | Users must call the initialize function with a unique application ID to use the UI Events Framework. The application ID helps debug purposes when testing. |
version | No | Oracle aims maintain backward compatibility for all the releases. If in the future, the framework deprecates some APIs without backward compatibility, use this parameter to load older or newer versions of the library. Currently, the version value defaults to v1. |
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: CX_SVC_UI_EVENTS_FRAMEWORK.IUiEventsFrameworkProvider = await
CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const frameworkProvider = await
CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
Retrieve the Corresponding Context for the Use Case
Once you can retrieve the instance of IUiEventsFrameworkProvider, you can now choose the context based on use cases.
- GlobalContext
- TabContext
- RecordContext
All the extensible events and actions of UEF are supported on top of contexts like GlobalContext, TabContext, and RecordContext. The following diagram shows the hierarchy of these contexts that are maintained in UEF and the supported events, actions, and APIs supported in each context:
The following graphic shows the overall architecture: