mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 01:43:15 +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.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
|
||||||
|
|
||||||
|
// 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) {
|
invoke: function(x) {
|
||||||
window.webkit.messageHandlers.external.postMessage(x);
|
window.webkit.messageHandlers.external.postMessage(x);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Setup internal calls
|
// Setup internal calls
|
||||||
var internal = {
|
var internal = {
|
||||||
|
Loading…
Reference in New Issue
Block a user