1.0.0 • Published 6 years ago

@widget-kit/container-plugin-size v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

@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: a Container instance returned by createContainer.
  • 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).