mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 06:01:48 +08:00
change window.external handling to fix windows (#669)
This commit is contained in:
parent
3c6182c622
commit
7036a3183e
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…
Reference in New Issue
Block a user