5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 19:01:02 +08:00
wails/v3/internal/runtime/desktop/main.js
2023-02-12 13:36:58 +11:00

68 lines
1.4 KiB
JavaScript

/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
/* jshint esversion: 9 */
import * as Clipboard from './clipboard';
import * as Application from './application';
import * as Log from './log';
import {newWindow} from "./window";
import {dispatchCustomEvent, Emit, Off, OffAll, On, Once, OnMultiple} from "./events";
import {dialogCallback, dialogErrorCallback, Error, Info, OpenFile, Question, SaveFile, Warning,} from "./dialogs";
import {enableContextMenus} from "./contextmenu";
window.wails = {
...newRuntime(-1),
};
// Internal wails endpoints
window._wails = {
dialogCallback,
dialogErrorCallback,
dispatchCustomEvent,
}
export function newRuntime(id) {
return {
Clipboard: {
...Clipboard
},
Application: {
...Application
},
Log,
Dialog: {
Info,
Warning,
Error,
Question,
OpenFile,
SaveFile,
},
Events: {
Emit,
On,
Once,
OnMultiple,
Off,
OffAll,
},
Window: newWindow(id),
}
}
if (DEBUG) {
console.log("Wails v3.0.0 Debug Mode Enabled");
}
enableContextMenus(true);