gardr-plugin-ext-send-size
v0.1.2
Published
Gardr plugin for sending iframe inner via xde
Readme
Gardr Send Size Plugin (Ext)
Gardr plugin for sending size of an iframe content to host at any given time.
Install
npm install gardr-plugin-ext-send-size --saveBundle
In your ext bundle file:
var gardrExt = require('gardr-ext');
var sendSize = require('gardr-plugin-ext-send-size');
gardrExt.plugin(sendSize);
module.exports = gardrExt;Usage
This plugin uses cross-domain-events to communicate between frames with "plugin:send-size" namespace.
To trigger it in host:
var xde = require('cross-domain-events');
xde.on('plugin:send-size', function(response) { // listen for plugin:send-size response
console.log(response.data.id); // id of an gardr iframe
console.log(response.data.size); // object containing width and height of iframe contents
});
xde.sendTo(document.querySelector('#banner').contentWindow, 'plugin:send-size'); // send plugin:send-size trigger to iframe inside div#banner