mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 17:41:24 +08:00
31 lines
724 B
JavaScript
31 lines
724 B
JavaScript
/*
|
|
_ __ _ __
|
|
| | / /___ _(_) /____
|
|
| | /| / / __ `/ / / ___/
|
|
| |/ |/ / /_/ / / (__ )
|
|
|__/|__/\__,_/_/_/____/
|
|
The electron alternative for Go
|
|
(c) Lea Anthony 2019-present
|
|
*/
|
|
/* jshint esversion: 6 */
|
|
|
|
/**
|
|
* WailsInvoke sends the given message to the backend
|
|
*
|
|
* @param {string} message
|
|
*/
|
|
|
|
(function () {
|
|
// Credit: https://stackoverflow.com/a/2631521
|
|
let _deeptest = function (s) {
|
|
var obj = window[s.shift()];
|
|
while (obj && s.length) obj = obj[s.shift()];
|
|
return obj;
|
|
};
|
|
window.WailsInvoke = _deeptest(["chrome", "webview", "postMessage"]) ||
|
|
_deeptest(["webkit", "messageHandlers", "external", "postMessage"]);
|
|
|
|
if (!window.WailsInvoke) {
|
|
console.error("Unsupported Platform");
|
|
}
|
|
})(); |