UNPKG

@drieam/common

Version:

Default Drieam api wrapper

25 lines (22 loc) 818 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.broadcastMessage = broadcastMessage; exports.postLtiFrameResize = postLtiFrameResize; // 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] : '*'; parent.postMessage(message, targetOrigin); } function postLtiFrameResize(height) { if (height > 0) { var message = { height: height, subject: 'lti.frameResize' }; broadcastMessage(JSON.stringify(message)); } }