Skip to content

Commit 1e0e1b8

Browse files
committed
doc: add api annotations.
1 parent 142180f commit 1e0e1b8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

core/src/index.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ export { FrameContext, useFrame } from './Context';
66

77
export interface IFrameProps
88
extends React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement> {
9+
/**
10+
* The `head` prop is a dom node that gets inserted before the children of the frame.
11+
*/
912
head?: React.ReactNode;
13+
/**
14+
* The `initialContent` props is the initial html injected into frame.
15+
* It is only injected once,
16+
* but allows you to insert any html into the frame (e.g. a [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) tag, [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) tags, etc).
17+
* Note that it does not update if you change the prop.
18+
*
19+
* Defaults to `<!DOCTYPE html><html><head></head><body></body></html>`
20+
*/
1021
initialContent?: string;
22+
/**
23+
* The `mountTarget` attribute is a css selector (`#target`/`.target`) that specifies the child within the initial content of the iframe to be mounted.
24+
*/
1125
mountTarget?: string;
1226
}
1327

@@ -33,8 +47,10 @@ const IFrame = forwardRef<HTMLIFrameElement, IFrameProps>(
3347
return doc?.body;
3448
};
3549
const handleLoad = useCallback(() => {
36-
// In certain situations on a cold cache DOMContentLoaded never gets called
37-
// fallback to an interval to check if that's the case
50+
/**
51+
* In certain situations on a cold cache DOMContentLoaded never gets called
52+
* fallback to an interval to check if that's the case
53+
*/
3854
const loadCheck = () => setInterval(() => handleLoad(), 500);
3955
clearInterval(loadCheck());
4056
// Bail update as some browsers will trigger on both DOMContentLoaded & onLoad ala firefox

0 commit comments

Comments
 (0)