change window.external handling to fix windows (#669)

This commit is contained in:
Austin Schey
2021-04-12 06:13:11 +10:00
committed by GitHub
parent 3c6182c622
commit 7036a3183e
2 changed files with 14 additions and 8 deletions
File diff suppressed because one or more lines are too long
+13 -7
View File
@@ -21,13 +21,19 @@ import * as Store from './store';
window.wails = window.wails || {};
window.backend = {};
// On webkit2gtk >= 2.32, the external object is not passed
// to the window context,
window.external = window.external || {
invoke: function(x) {
window.webkit.messageHandlers.external.postMessage(x);
}
};
// On webkit2gtk >= 2.32, the external object is not passed to the window context.
// However, IE will throw a strict mode error if window.external is assigned to
// so we need to make sure that line of code isn't reached in IE
// Using !window.external transpiles to `window.external = window.external || ...`
// so we have to use an explicit if statement to prevent webpack from optimizing the code.
if (window.external == undefined) {
window.external = {
invoke: function(x) {
window.webkit.messageHandlers.external.postMessage(x);
}
};
}
// Setup internal calls
var internal = {