UNPKG

@drieam/common

Version:

Default Drieam api wrapper

20 lines (18 loc) 745 B
// Inspired by // https://github.com/atomicjolt/lti_starter_app/blob/d5a59a04e7e14cb28d08dc8fba2a735b3831b573/client/common/libs/resize_iframe.js // https://github.com/atomicjolt/atomic-fuel/blob/73b8718bbc2a6d3bd991fab2bfdd711c79f6d7bd/src/communications/communicator.js function broadcastMessage(message) { var targetOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "*"; // eslint-disable-next-line no-restricted-globals parent.postMessage(message, targetOrigin); } function postLtiFrameResize(height) { if (height > 0) { var message = { height: height, subject: "lti.frameResize" }; broadcastMessage(JSON.stringify(message)); } } export { broadcastMessage, postLtiFrameResize };