Skip to content

Commit

Permalink
fix: #658 polyfill window.external for webkit2gtk > 2.32 (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdidron authored Apr 9, 2021
1 parent 163c0d9 commit 87df51f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion runtime/assets/wails.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions runtime/js/core/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
_ __ _ __
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The lightweight framework for web-like apps
(c) Lea Anthony 2019-present
*/
Expand All @@ -21,6 +21,14 @@ 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);
}
};

// Setup internal calls
var internal = {
NewBinding,
Expand Down Expand Up @@ -61,7 +69,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
};

// Use firebug?
if( window.usefirebug ) {
if( window.usefirebug ) {
InjectFirebug();
}

Expand All @@ -71,4 +79,4 @@ Emit('wails:loaded');
// Nothing to init in production
export function Init(callback) {
callback();
}
}

0 comments on commit 87df51f

Please sign in to comment.