hypnagaga/src/components/PymChild/PymChild.mdx
2025-04-18 16:21:25 +01:00

33 lines
757 B
Text

import { Meta } from '@storybook/blocks';
import * as PymChildStories from './PymChild.stories.svelte';
<Meta of={PymChildStories} />
# PymChild
The `PymChild` component creates a [Pym.js](https://blog.apps.npr.org/pym.js/) child instance for embeddables.
```svelte
<script>
import { PymChild } from '@reuters-graphics/graphics-components';
</script>
<PymChild polling={500} />
```
You can access the Pym.js child via `pym` in other components to send custom height updates to parent frames:
```svelte
<script>
import { PymChild, pym } from '@reuters-graphics/graphics-components';
const updateHeight = () => {
if (pym.child) pym.child.sendHeight();
};
</script>
<PymChild />
<button onclick={updateHeight}>Update height</button>
```