@widget-kit/container-plugin-size
v1.0.0
Published
Control iframe size from widget within iframe
Downloads
17
Maintainers
Readme
@widget-kit/container-plugin-size
Control iframe size from widget.
Install
$ npm install --save @widget-kit/container-plugin-size
Usage
// Main window ("loader" script):
initSizePlugin(container, {
initialSize: {
width: '100%',
height: '0',
},
});
// Widget:
const request = setSize({
height: '100%',
maxHeight: '500px',
});
widget.send(request);
API Reference
initSizePlugin(container, [config])
Registers handler for setSize
requests and allows to set initial size.
container
: aContainer
instance returned bycreateContainer
.config
: allows to set initial size properties (width, height, maxWidth and maxHeight). All properties accept string values (e.g. '200px' or '100%').
setSize(size)
Creates request with a new size.
size
: properties that would be changed (width, height, maxWidth, maxHeight).