Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2268,6 +2268,11 @@ export enum HostEvent {
* @hidden
*/
Reload = 'reload',
/**
* Get current iframe src
* @hidden
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why @hidden tag is added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, It's not available in docs, will raise one ticket for @ShashiSubramanya

*/
GetIframeSrc = 'getIframeSrc',
/**
* Display specific visualizations on a Liveboard.
* @param - An array of GUIDs of the visualization to show. The visualization IDs not passed
Expand Down
12 changes: 12 additions & 0 deletions src/utils/processTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ export const reload = (iFrame: HTMLIFrameElement) => {
}, 100);
};

/**
* Get the source URL of an iframe
* @param iFrame
* @returns The src URL of the iframe
*/
export const getIframeSrc = (iframe: HTMLIFrameElement): string => {
return iframe.src;
};

/**
* Post iframe message.
* @param iFrame
Expand Down Expand Up @@ -51,6 +60,9 @@ export function processTrigger(
reload(iFrame);
return res(null);
}
if (messageType === HostEvent.GetIframeSrc) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

return getIframeSrc(iFrame);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass the result into res check above

also test it out in app embed , if route changes return proper urls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, right.
Will test in app embed

}
const channel = new MessageChannel();
channel.port1.onmessage = ({ data: responseData }) => {
channel.port1.close();
Expand Down