5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 15:30:37 +08:00

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

This commit is contained in:
Austin Schey 2021-04-11 15:13:11 -05:00 committed by GitHub
parent 3c6182c622
commit 7036a3183e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,13 +21,19 @@ import * as Store from './store';
window.wails = window.wails || {}; window.wails = window.wails || {};
window.backend = {}; window.backend = {};
// On webkit2gtk >= 2.32, the external object is not passed // On webkit2gtk >= 2.32, the external object is not passed to the window context.
// to the window context, // However, IE will throw a strict mode error if window.external is assigned to
window.external = window.external || { // so we need to make sure that line of code isn't reached in IE
invoke: function(x) {
window.webkit.messageHandlers.external.postMessage(x); // 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 // Setup internal calls
var internal = { var internal = {