You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<div id="foo"></div>
<script>
var pymParent = new pym.Parent('foo', 'child.html', {});
</script>
(child) function render(width) { pymChild.sendHeight(); } var pymChild = new pym.Child({ renderCallback: render })
The page loads only the top 150px of the content (blank for the rest all the way to the bottom). The parent div shows a height of 154px, the iframe shows height of 150px, and the html inside the iframe renders 1500px which includes the top 150px that does get loaded. The console shows an error:
Uncaught TypeError: Cannot read properties of undefined (reading 'sendHeight') at Object.render [as renderCallback] (child.html?initialWidth=1664&childId=foo&parentTitle=Test PYM.js&parentUrl=file%3A%2F%2F%2FUsers%2Fwaltemik%2FDesktop%2Fppv-elearning%2Findex.html:2551) at new a.Child (pym.v1.min.js:3) at child.html?initialWidth=1664&childId=foo&parentTitle=Test PYM.js&parentUrl=file%3A%2F%2F%2FUsers%2Fwaltemik%2FDesktop%2Fppv-elearning%2Findex.html:2556
The text was updated successfully, but these errors were encountered:
The renderCallback is immediately invoked when a Pym guest instance is constructed, which means that technically pymChild hasn't been assigned yet when it is run. You may want to add a guard to your code, something like if (pymChild) pymChild.sendHeight();, to handle this case. Alternately, switch to the polling option, which is much easier to manage than manually sending the height after each render.
When we run the code:(parent)
(child)
function render(width) { pymChild.sendHeight(); } var pymChild = new pym.Child({ renderCallback: render })
The page loads only the top 150px of the content (blank for the rest all the way to the bottom). The parent div shows a height of 154px, the iframe shows height of 150px, and the html inside the iframe renders 1500px which includes the top 150px that does get loaded. The console shows an error:
Uncaught TypeError: Cannot read properties of undefined (reading 'sendHeight') at Object.render [as renderCallback] (child.html?initialWidth=1664&childId=foo&parentTitle=Test PYM.js&parentUrl=file%3A%2F%2F%2FUsers%2Fwaltemik%2FDesktop%2Fppv-elearning%2Findex.html:2551) at new a.Child (pym.v1.min.js:3) at child.html?initialWidth=1664&childId=foo&parentTitle=Test PYM.js&parentUrl=file%3A%2F%2F%2FUsers%2Fwaltemik%2FDesktop%2Fppv-elearning%2Findex.html:2556
The text was updated successfully, but these errors were encountered: