jupyterlab-emrys
Version:
A computational environment for Jupyter. Powered by Emrys
48 lines (47 loc) • 1.44 kB
JavaScript
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
;
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var phosphor_widget_1 = require('phosphor-widget');
/**
* The class name added to an IFrame widget.
*/
var IFRAME_CLASS = 'jp-IFrame';
/**
* A phosphor widget which wraps an IFrame.
*/
var IFrame = (function (_super) {
__extends(IFrame, _super);
/**
* Create a new iframe widget.
*/
function IFrame() {
_super.call(this);
this.addClass(IFRAME_CLASS);
}
/**
* Create the main content node of an iframe widget.
*/
IFrame.createNode = function () {
var node = document.createElement('div');
var iframe = document.createElement('iframe');
iframe.style.height = '100%';
iframe.style.width = '100%';
node.appendChild(iframe);
return node;
};
/**
* Load a URL into the iframe.
*
* @param url - The URL to load into the iframe widget.
*/
IFrame.prototype.loadURL = function (url) {
this.node.querySelector('iframe').setAttribute('src', url);
};
return IFrame;
}(phosphor_widget_1.Widget));
exports.IFrame = IFrame;