diff --git a/v2/internal/runtime/js/desktop/darwin.js b/v2/internal/runtime/js/desktop/darwin.js index a38fa0727..87cbb8635 100644 --- a/v2/internal/runtime/js/desktop/darwin.js +++ b/v2/internal/runtime/js/desktop/darwin.js @@ -13,56 +13,53 @@ The lightweight framework for web-like apps * Initialises platform specific code */ -// import * as common from './common'; -const common = require('./common'); - export const System = { - ...common, - Platform: () => "darwin", -} + AppType: 'desktop', + Platform: () => 'darwin', +}; export function SendMessage(message) { - window.webkit.messageHandlers.external.postMessage(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) { - let 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; - } - }); + // Setup drag handler + // Based on code from: https://github.com/patr0nus/DeskGap + window.addEventListener('mousedown', function (e) { + let 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; + } + }); - // Setup context menu hook - window.addEventListener('contextmenu', function (e) { - let currentElement = e.target; - let contextMenuId; - while (currentElement != null) { - contextMenuId = currentElement.dataset['wails-context-menu-id']; - if (contextMenuId != null) { - break; - } - currentElement = currentElement.parentElement; - } - if (contextMenuId != null || window.disableWailsDefaultContextMenu) { - e.preventDefault(); - } - if( contextMenuId != null ) { - let contextData = currentElement.dataset['wails-context-menu-data']; - let message = { - id: contextMenuId, - data: contextData || "", - }; - window.webkit.messageHandlers.contextMenu.postMessage(JSON.stringify(message)); - } - }); + // Setup context menu hook + window.addEventListener('contextmenu', function (e) { + let currentElement = e.target; + let contextMenuId; + while (currentElement != null) { + contextMenuId = currentElement.dataset['wails-context-menu-id']; + if (contextMenuId != null) { + break; + } + currentElement = currentElement.parentElement; + } + if (contextMenuId != null || window.disableWailsDefaultContextMenu) { + e.preventDefault(); + } + if( contextMenuId != null ) { + let contextData = currentElement.dataset['wails-context-menu-data']; + let message = { + id: contextMenuId, + data: contextData || '', + }; + window.webkit.messageHandlers.contextMenu.postMessage(JSON.stringify(message)); + } + }); } \ No newline at end of file diff --git a/v2/internal/runtime/js/desktop/linux.js b/v2/internal/runtime/js/desktop/linux.js index a1ecceeef..f6622001a 100644 --- a/v2/internal/runtime/js/desktop/linux.js +++ b/v2/internal/runtime/js/desktop/linux.js @@ -14,28 +14,28 @@ The lightweight framework for web-like apps */ export const System = { - ...common, - Platform: () => "linux", -} + AppType: 'desktop', + Platform: () => 'linux', +}; export function SendMessage(message) { - window.webkit.messageHandlers.external.postMessage(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) { - let 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; - } - }); + // Setup drag handler + // Based on code from: https://github.com/patr0nus/DeskGap + window.addEventListener('mousedown', function (e) { + let 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; + } + }); } \ No newline at end of file diff --git a/v2/internal/runtime/js/desktop/windows.js b/v2/internal/runtime/js/desktop/windows.js index 31f608381..7c0d3aa94 100644 --- a/v2/internal/runtime/js/desktop/windows.js +++ b/v2/internal/runtime/js/desktop/windows.js @@ -13,11 +13,8 @@ The lightweight framework for web-like apps * Initialises platform specific code */ -// import * as common from './common'; -const common = require('./common'); - export const System = { - ...common, + AppType: 'desktop', Platform: () => 'windows', };