mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[mac] Update runtime to use window.wailsInvoke
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -983,7 +983,7 @@ void SaveDialog(struct Application *app, char *callbackID, char *title, char *fi
|
||||
);
|
||||
}
|
||||
|
||||
const char *invoke = "window.external={invoke:function(x){window.webkit.messageHandlers.external.postMessage(x);}};";
|
||||
const char *invoke = "window.wailsInvoke=function(message){window.webkit.messageHandlers.external.postMessage(message);};window.wailsDrag=function(message){window.webkit.messageHandlers.windowDrag.postMessage(message);};window.wailsContextMenuMessage=function(message){window.webkit.messageHandlers.contextMenu.postMessage(message);};";
|
||||
|
||||
// DisableFrame disables the window frame
|
||||
void DisableFrame(struct Application *app)
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -19,7 +19,7 @@ export const System = {
|
||||
};
|
||||
|
||||
export function SendMessage(message) {
|
||||
window.webkit.messageHandlers.external.postMessage(message);
|
||||
window.wailsInvoke(message);
|
||||
}
|
||||
|
||||
export function Init() {
|
||||
@@ -32,7 +32,7 @@ export function Init() {
|
||||
if (currentElement.hasAttribute('data-wails-no-drag')) {
|
||||
break;
|
||||
} else if (currentElement.hasAttribute('data-wails-drag')) {
|
||||
window.webkit.messageHandlers.windowDrag.postMessage(null);
|
||||
window.wailsDrag(null);
|
||||
break;
|
||||
}
|
||||
currentElement = currentElement.parentElement;
|
||||
@@ -59,7 +59,7 @@ export function Init() {
|
||||
id: contextMenuId,
|
||||
data: contextData || '',
|
||||
};
|
||||
window.webkit.messageHandlers.contextMenu.postMessage(JSON.stringify(message));
|
||||
window.wailsContextMenuMessage(JSON.stringify(message));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1562,6 +1562,12 @@
|
||||
window.wailsInvoke = (message) => {
|
||||
websocket.send(message);
|
||||
};
|
||||
window.wailsDrag = (message) => {
|
||||
websocket.send(message);
|
||||
};
|
||||
window.wailsContextMenuMessage = (message) => {
|
||||
websocket.send(message);
|
||||
};
|
||||
}
|
||||
|
||||
// Handles incoming websocket connections
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wails/runtime",
|
||||
"version": "1.3.18",
|
||||
"version": "1.3.19",
|
||||
"description": "Wails V2 Javascript runtime library",
|
||||
"main": "main.js",
|
||||
"types": "runtime.d.ts",
|
||||
|
||||
Reference in New Issue
Block a user