5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-16 17:09:28 +08:00
wails/runtime/js/src/ipc.js
2019-07-13 22:12:49 +10:00

30 lines
597 B
JavaScript

/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The lightweight framework for web-like apps
(c) Lea Anthony 2019-present
*/
/* jshint esversion: 6 */
function Invoke(message) {
if (window && window.external && window.external.invoke) {
window.external.invoke(message);
} else {
//eslint-disable-line
console.log(`[No external.invoke] ${message}`);
}
}
export function SendMessage(type, payload, callbackID) {
const message = {
type,
callbackID,
payload
};
Invoke(JSON.stringify(message));
}