Removed lazy loading

This commit is contained in:
Fabien O'Carroll 2019-04-16 11:33:04 +02:00
parent de410052dd
commit 60cdf82354

View File

@ -11,22 +11,18 @@ module.exports = function layer2(options) {
container
});
var loadAuth = lazyLoadFrame(authUrl, container);
var getAuthFrame = function () {
return loadAuth().then(function (frame) {
frame.style.position = 'fixed';
frame.style.width = '100%';
frame.style.height = '100%';
frame.style.background = 'transparent';
frame.style.top = '0';
frame.style['z-index'] = '9999';
return frame;
});
};
var loadAuth = loadFrame(authUrl, container).then(function (frame) {
frame.style.position = 'fixed';
frame.style.width = '100%';
frame.style.height = '100%';
frame.style.background = 'transparent';
frame.style.top = '0';
frame.style['z-index'] = '9999';
return frame;
});
function openAuth(hash, query = '') {
return getAuthFrame().then(function (frame) {
return loadAuth.then(function (frame) {
return new Promise(function (resolve) {
frame.src = `${authUrl}#${hash}?${query}`;
frame.style.display = 'block';
@ -82,17 +78,6 @@ module.exports = function layer2(options) {
});
};
function lazyLoadFrame(src, container) {
let promise;
return function getFrame() {
if (promise) {
return promise;
}
promise = loadFrame(src, container);
return promise;
};
}
function loadFrame(src, container = document.body) {
return new Promise(function (resolve) {
const frame = document.createElement('iframe');