export default function () { Ext.define('Ext.ux.IFrame', { extend: 'Ext.Component', alias: 'widget.uxiframe', loadMask: 'Loading...', src: 'about:blank', renderTpl: [ '' ], childEls: ['iframeEl'], initComponent: function () { this.superclass.initComponent.call(this) this.superclass.initEvents.call(this) this.frameName = this.frameName || this.id + '-frame'; }, initEvents: function () { var me = this; this.superclass.initEvents.call(this) me.iframeEl.on('load', me.onLoad, me); }, initRenderData: function () { return Ext.apply(this.superclass.initRenderData.call(this), { src: this.src, frameName: this.frameName }); }, getBody: function () { var doc = this.getDoc(); return doc.body || doc.documentElement; }, getDoc: function () { try { return this.getWin().document; } catch (ex) { return null; } }, getWin: function () { var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name]; return win; }, getFrame: function () { var me = this; return me.iframeEl.dom; }, onLoad: function () { var me = this, doc = me.getDoc(); if (doc) { this.el.unmask(); this.fireEvent('load', this); } else if (me.src) { this.el.unmask(); this.fireEvent('error', this); } }, load: function (src) { var me = this, text = me.loadMask, frame = me.getFrame(); if (me.fireEvent('beforeload', me, src) !== false) { if (text && me.el) { me.el.mask(text); } frame.src = me.src = (src || me.src); } } }); }