mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 05:11:29 +08:00

* Tidy up runtime JS * Initial implementation of runtime over http * Update runtime deps. Fix test task. * Support Clipboard. Message Processor refactor. * Add `Window.Screen()` Clipboard `GetText` -> `Text` * Support most dialogs Better JS->Go object mapping Implement Go->JS callback mechanism Rename `window.runtime` -> `window.wails` to better reflect the Go API * Support SaveFile dialog * Remove go.work * Tidy up * Event->CustomEvent to prevent potential clash with native JS Event object Support Eventing * Support application calls * Support logging * Support named windows Remove debug info * Update v3 changes
66 lines
1.3 KiB
JavaScript
66 lines
1.3 KiB
JavaScript
/*
|
|
_ __ _ __
|
|
| | / /___ _(_) /____
|
|
| | /| / / __ `/ / / ___/
|
|
| |/ |/ / /_/ / / (__ )
|
|
|__/|__/\__,_/_/_/____/
|
|
The electron alternative for Go
|
|
(c) Lea Anthony 2019-present
|
|
*/
|
|
/* jshint esversion: 9 */
|
|
|
|
import {dialogCallback, dialogErrorCallback, Error, Info, OpenFile, Question, SaveFile, Warning,} from "./dialogs";
|
|
|
|
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";
|
|
|
|
// Internal wails endpoints
|
|
window.wails = {
|
|
...newRuntime(-1),
|
|
};
|
|
|
|
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");
|
|
}
|
|
|