feat: add onBeforeMount callback to createIframeUi options (#1899)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@ export function createIframeUi<TMounted>(
|
||||
let mounted: TMounted | undefined = undefined;
|
||||
const mount = () => {
|
||||
applyPosition(wrapper, iframe, options);
|
||||
options.onBeforeMount?.(wrapper, iframe);
|
||||
mountUi(wrapper, options);
|
||||
mounted = options.onMount?.(wrapper, iframe);
|
||||
};
|
||||
@@ -73,4 +74,9 @@ export type IframeContentScriptUiOptions<TMounted> =
|
||||
* Optionally return a value that can be accessed at `ui.mounted` or in the `onRemove` callback.
|
||||
*/
|
||||
onMount?: (wrapper: HTMLElement, iframe: HTMLIFrameElement) => TMounted;
|
||||
/**
|
||||
* Callback executed before mounting the UI. Use this function to customize the iframe or wrapper
|
||||
* elements before they are injected into the DOM. It is called every time `ui.mount()` is called.
|
||||
*/
|
||||
onBeforeMount?: (wrapper: HTMLElement, iframe: HTMLIFrameElement) => void;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user