IObjectContext
Every event or operation response will have a getContext() method which will return IObjectContext object.
Functions
getObjectType
This function is used to get the object type from the response's context information.
The following code sample shows the syntax for
getObjectType:
getObjectType(): string;
The following code snippet shows an example in Typescript for subscribing to
ContextOpen event where getObjectType method is
used.
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const requestObject: CX_SVC_UI_EVENTS_FRAMEWORK.IEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent');
tabContext.subscribe(requestObject, (response: IEventResponse) => {
console.log(response.getContext().getObjectType()); // usage of getObjectType
});
The following code snippet shows an example in javascript for subscribing to
ContextOpen event where getObjectType method is
used.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent')
tabContext.subscribe(requestObject, (response) => {
console.log(response.getContext().getObjectType()); // usage of getObjectType
});
getObjectId
This function is used to get the object unique identifier from the response's context information.
The following code sample shows the syntax for
getObjectId.
getObjectId(): string;
The following code sample shows an example in typescript for subscribing to
ContextOpen event where getObjectId method is
used.
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const requestObject: CX_SVC_UI_EVENTS_FRAMEWORK.IEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent');
tabContext.subscribe(requestObject, (response: IEventResponse) => {
console.log(response.getContext().getObjectId()); // usage of getObjectId
});
The following code sample shows an example in Javascript for subscribing to
ContextOpen event where getObjectId method is
used.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent')
tabContext.subscribe(requestObject, (response) => {
console.log(response.getContext().getObjectId()); // usage of getObjectId
});
getTabId
This function is used to get the browser tab's unique identifier from the response object's context information..
The following code sample shows the syntax for
getTabId.
getTabId(): string;
The following code sample shows an example in Typescript for subscribing to
ContextClose event where getTabId method is
used:
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const requestObject: CX_SVC_UI_EVENTS_FRAMEWORK.IEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent');
tabContext.subscribe(requestObject, (response: IEventResponse) => {
console.log(response.getContext().getTabId()); // usage of getTabId
});
The following code sample shows an example in Javascript for subscribing to
ContextClose event where getTabId method is
used:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent')
tabContext.subscribe(requestObject, (response) => {
console.log(response.getContext().getTabId()); // usage of getTabId
});
getMsiTabId
This function is used to get the MSI tab's unique identifier from the response object's context information.
The following code sample shows the syntax for
getMsiTabId.
getMsiTabId(): string;
The following code sample shows an example in Typescript for subscribing to
ContextClose event where getMsiTabId method is
used:
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const requestObject: CX_SVC_UI_EVENTS_FRAMEWORK.IEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent');
tabContext.subscribe(requestObject, (response: IEventResponse) => {
console.log(response.getContext().getMsiTabId()); // usage of getMsiTabId
});
The following code sample shows an example in Javascript for subscribing to
ContextClose event where getMsiTabId method is
used:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent')
tabContext.subscribe(requestObject, (response) => {
console.log(response.getContext().getMsiTabId()); // usage of getMsiTabId
});
getMsiSubTabId
This function is used to get the MSI subtab's unique identifier from the response's context information. .
The following code sample shows the syntax for
getMsiSubTabId.
getMsiSubTabId(): string;
The following code sample shows an example in Typescript for subscribing to
ContextClose event where getMsiSubTabId method is
used:
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const requestObject: CX_SVC_UI_EVENTS_FRAMEWORK.IEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent');
tabContext.subscribe(requestObject, (response: IEventResponse) => {
console.log(response.getContext().getMsiSubTabId()); // usage of getMsiSubTabId
});
The following code sample shows an example in Javascript for subscribing to
ContextClose event where getMsiSubTabId method is
used:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusContextCloseEvent')
tabContext.subscribe(requestObject, (response) => {
consol