mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 08:31:47 +08:00
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
/*
|
|
_ __ _ __
|
|
| | / /___ _(_) /____
|
|
| | /| / / __ `/ / / ___/
|
|
| |/ |/ / /_/ / / (__ )
|
|
|__/|__/\__,_/_/_/____/
|
|
The lightweight framework for web-like apps
|
|
(c) Lea Anthony 2019-present
|
|
*/
|
|
/* jshint esversion: 6 */
|
|
|
|
/**
|
|
* Initialises platform specific code
|
|
*/
|
|
|
|
// import * as common from './common';
|
|
const common = require('./common');
|
|
|
|
export const System = {
|
|
...common,
|
|
Platform: () => "darwin",
|
|
}
|
|
|
|
export function SendMessage(message) {
|
|
window.webkit.messageHandlers.external.postMessage(message);
|
|
}
|
|
|
|
export function Init() {
|
|
|
|
// Setup drag handler
|
|
// Based on code from: https://github.com/patr0nus/DeskGap
|
|
window.addEventListener('mousedown', function (e) {
|
|
var currentElement = e.target;
|
|
while (currentElement != null) {
|
|
if (currentElement.hasAttribute('data-wails-no-drag')) {
|
|
break;
|
|
} else if (currentElement.hasAttribute('data-wails-drag')) {
|
|
window.webkit.messageHandlers.windowDrag.postMessage(null);
|
|
break;
|
|
}
|
|
currentElement = currentElement.parentElement;
|
|
}
|
|
});
|
|
} |