mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
change window.external handling to fix windows (#669)
This commit is contained in:
parent
3c6182c622
commit
7036a3183e
2 changed files with 14 additions and 8 deletions
File diff suppressed because one or more lines are too long
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue