Merged PR 22268: fix front load timing
fix front load timing
This commit is contained in:
Родитель
0c5386f0b2
Коммит
59d05f53b4
|
@ -900,6 +900,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
if (errors) {
|
||||
throw errors;
|
||||
}
|
||||
// contentWindow must be initialized
|
||||
if (this.iframe.contentWindow == null)
|
||||
return;
|
||||
return this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow).then(function (response) {
|
||||
return response.body;
|
||||
}, function (response) {
|
||||
|
@ -5957,7 +5960,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/* 18 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/*! http-post-message v0.2.4 | (c) 2016 Microsoft Corporation MIT */
|
||||
/*! http-post-message v0.2.3 | (c) 2016 Microsoft Corporation MIT */
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(true)
|
||||
module.exports = factory();
|
||||
|
@ -6012,126 +6015,126 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports) {
|
||||
/***/ function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
var HttpPostMessage = (function () {
|
||||
function HttpPostMessage(windowPostMessageProxy, defaultHeaders, defaultTargetWindow) {
|
||||
if (defaultHeaders === void 0) { defaultHeaders = {}; }
|
||||
this.defaultHeaders = defaultHeaders;
|
||||
this.defaultTargetWindow = defaultTargetWindow;
|
||||
this.windowPostMessageProxy = windowPostMessageProxy;
|
||||
}
|
||||
// TODO: See if it's possible to share tracking properties interface?
|
||||
// The responsibility of knowing how to configure windowPostMessageProxy for http should
|
||||
// live in this http class, but the configuration would need ITrackingProperties
|
||||
// interface which lives in WindowPostMessageProxy. Use <any> type as workaround
|
||||
HttpPostMessage.addTrackingProperties = function (message, trackingProperties) {
|
||||
message.headers = message.headers || {};
|
||||
if (trackingProperties && trackingProperties.id) {
|
||||
message.headers.id = trackingProperties.id;
|
||||
}
|
||||
return message;
|
||||
};
|
||||
HttpPostMessage.getTrackingProperties = function (message) {
|
||||
return {
|
||||
id: message.headers && message.headers.id
|
||||
};
|
||||
};
|
||||
HttpPostMessage.isErrorMessage = function (message) {
|
||||
if (typeof (message && message.statusCode) !== 'number') {
|
||||
return false;
|
||||
}
|
||||
return !(200 <= message.statusCode && message.statusCode < 300);
|
||||
};
|
||||
HttpPostMessage.prototype.get = function (url, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "GET",
|
||||
url: url,
|
||||
headers: headers
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.post = function (url, body, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "POST",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.put = function (url, body, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "PUT",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.patch = function (url, body, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "PATCH",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.delete = function (url, body, headers, targetWindow) {
|
||||
if (body === void 0) { body = null; }
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "DELETE",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.send = function (request, targetWindow) {
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
request.headers = this.assign({}, this.defaultHeaders, request.headers);
|
||||
if (!targetWindow) {
|
||||
throw new Error("target window is not provided. You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class.");
|
||||
}
|
||||
return this.windowPostMessageProxy.postMessage(targetWindow, request);
|
||||
};
|
||||
/**
|
||||
* Object.assign() polyfill
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
||||
*/
|
||||
HttpPostMessage.prototype.assign = function (target) {
|
||||
var sources = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
sources[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (target === undefined || target === null) {
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
var output = Object(target);
|
||||
sources.forEach(function (source) {
|
||||
if (source !== undefined && source !== null) {
|
||||
for (var nextKey in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, nextKey)) {
|
||||
output[nextKey] = source[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return output;
|
||||
};
|
||||
return HttpPostMessage;
|
||||
}());
|
||||
exports.HttpPostMessage = HttpPostMessage;
|
||||
"use strict";
|
||||
var HttpPostMessage = (function () {
|
||||
function HttpPostMessage(windowPostMessageProxy, defaultHeaders, defaultTargetWindow) {
|
||||
if (defaultHeaders === void 0) { defaultHeaders = {}; }
|
||||
this.defaultHeaders = defaultHeaders;
|
||||
this.defaultTargetWindow = defaultTargetWindow;
|
||||
this.windowPostMessageProxy = windowPostMessageProxy;
|
||||
}
|
||||
// TODO: See if it's possible to share tracking properties interface?
|
||||
// The responsibility of knowing how to configure windowPostMessageProxy for http should
|
||||
// live in this http class, but the configuration would need ITrackingProperties
|
||||
// interface which lives in WindowPostMessageProxy. Use <any> type as workaround
|
||||
HttpPostMessage.addTrackingProperties = function (message, trackingProperties) {
|
||||
message.headers = message.headers || {};
|
||||
if (trackingProperties && trackingProperties.id) {
|
||||
message.headers.id = trackingProperties.id;
|
||||
}
|
||||
return message;
|
||||
};
|
||||
HttpPostMessage.getTrackingProperties = function (message) {
|
||||
return {
|
||||
id: message.headers && message.headers.id
|
||||
};
|
||||
};
|
||||
HttpPostMessage.isErrorMessage = function (message) {
|
||||
if (typeof (message && message.statusCode) !== 'number') {
|
||||
return false;
|
||||
}
|
||||
return !(200 <= message.statusCode && message.statusCode < 300);
|
||||
};
|
||||
HttpPostMessage.prototype.get = function (url, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "GET",
|
||||
url: url,
|
||||
headers: headers
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.post = function (url, body, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "POST",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.put = function (url, body, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "PUT",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.patch = function (url, body, headers, targetWindow) {
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "PATCH",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.delete = function (url, body, headers, targetWindow) {
|
||||
if (body === void 0) { body = null; }
|
||||
if (headers === void 0) { headers = {}; }
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
return this.send({
|
||||
method: "DELETE",
|
||||
url: url,
|
||||
headers: headers,
|
||||
body: body
|
||||
}, targetWindow);
|
||||
};
|
||||
HttpPostMessage.prototype.send = function (request, targetWindow) {
|
||||
if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
|
||||
request.headers = this.assign({}, this.defaultHeaders, request.headers);
|
||||
if (!targetWindow) {
|
||||
throw new Error("target window is not provided. You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class.");
|
||||
}
|
||||
return this.windowPostMessageProxy.postMessage(targetWindow, request);
|
||||
};
|
||||
/**
|
||||
* Object.assign() polyfill
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
||||
*/
|
||||
HttpPostMessage.prototype.assign = function (target) {
|
||||
var sources = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
sources[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (target === undefined || target === null) {
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
var output = Object(target);
|
||||
sources.forEach(function (source) {
|
||||
if (source !== undefined && source !== null) {
|
||||
for (var nextKey in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, nextKey)) {
|
||||
output[nextKey] = source[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return output;
|
||||
};
|
||||
return HttpPostMessage;
|
||||
}());
|
||||
exports.HttpPostMessage = HttpPostMessage;
|
||||
|
||||
|
||||
/***/ })
|
||||
/***/ }
|
||||
/******/ ])
|
||||
});
|
||||
;
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -615,6 +615,10 @@ export abstract class Embed {
|
|||
throw errors;
|
||||
}
|
||||
|
||||
// contentWindow must be initialized
|
||||
if (this.iframe.contentWindow == null)
|
||||
return;
|
||||
|
||||
return this.service.hpm.post<void>("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow).then(response => {
|
||||
return response.body;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче